I have an apache2 server running Phusion Passenger. On this machine I have two virtual hosts setup each look like this (path's are different for the 2nd virtualhost...but other directives are the same)
ServerName beta.mysite.us
DocumentRoot "/var/www/beta/mysite/public"
<Directory "/var/www/beta/mysite/public">
RewriteEng...
Posted a previous question on this, but have a followup. I was trying to create a workaround to use SSL on the expensive custom domain. I'm willing to live with bumping a user to https://app.heroku.com from http://www.app.com for certain secure pages, and have monkey-patched SSL required to make this happen. However, now this issue is...
ok, so probably best if i just paste code and then explain
search = "your horses"
exp1 = ""
exp2 = ""
myarray = search.split(/ /)
mylength = myarray.length #this would return 2 in this case
mylength.times do
exp1 += "AND name LIKE ? " #this gives--> AND name LIKE ? AND name LIKE ?
end
fo...
Hi, the front end and end-user data-collection we want to build in RoR since it's just some simple forms connected to a database.
The integration with other external api's such as twitter and facebook and parsing of the data entered by the users we want to do in python, mostly because the developer for that part knows python.
Is that p...
I have a rails helper using the structore below, but when I use it I get the message
undefined method 'link_to'
The helper is arranged as:
module MyHelper
class Facet
def render_for_search
link_to("Value", params)
end
end
class FacetList
attr_accessor :facets
def initialize
#Create facets
end...
I'm working on an ruby on rails app that has a special billing method.
I'm creating a store where users can reserve products but will not get charged for these products until a certain amount has been reached. This amount cannot be quantified by time so I'm wondering if this is a recurring payment. However, accounts will have to provide...
I have problem with mongomapper associations. I have one class names User and other named Model. User has many models but...
user = User.first
=> <User ...
user.models
=> []
Model.find_by_user_id(user.id.to_s)
=> <Model ...
Model.find_by_user_id(user.id.to_s).user == user
=> true
Class code (simplified):
class User
include MongoMap...
Is there a way to find out what associations a model has? Take these 2 models:
class Comment < ActiveRecord::Base
belongs_to :commentable
end
class Post < ActiveRecord::Base
has_many :comments
belongs_to :user
end
I'm looking for something like: Post.has_many #=> ['comments', 'tags', ...], Post.belongs_to # => ['user'] and Comm...
I'm new to rails and don't even know if this is the correct way of solving my situation.
I have a "Club" ActiveRecords model which has a "has_many" association to a "Member" model. I want the logged in "Club" to only be able to administrate it's own "Member" so in the beginning of each action in the "Member" model I did something simila...
How do you add span tags to the link below in ruby?
<%= link_to (l(:button_show), {:action => 'show', :path => to_path_param(@path)}, :class => "button") %>
I would like to add the span tags to the link like this:
<a href="/show" class="button"><span>Show</span></a>
...
In a functional test of my Rails app, I want to test where I am redirected to. The expected URL points to an external resource (that means it's not part of my application).
The URL looks like this: https://my.url.com/foo?bar1=xyz&bar2=123
Unfortunately I can't predict the parameters, because they are generated by an external resour...
I have the following html with multiple inputs:
<input type="submit" value="Save and close" name="commit"/>
<input type="submit" value="Save" name="commit"/>
and would like to use cucumber to test clicking on the "Save" button. However, when I do this in a cucumber test:
When I press "Save"
it clicks on the "Save and close" button,...
I know Rails' flash hash is nothing new, but I keep running into the same problem with it.
Controllers should be for business logic and db queries, not formatting strings for display to the user. But the flash hash is always set in the controller. This means that I need to hack and work around Rails to use Helpers that I made to format ...
When it comes to adding gems/plugins I notice that sometimes the author name is prepended to the gem/plugin name, whereas other times it isn't. Is there any reasoning behind this?
Example:
config.gem "thoughtbot-factory_girl", :source => "http://gems.github.com"
Why not have it as:
config.gem "factory_girl", :source => "http://gems....
I'm new to Rails (and ruby). What is the standard way of iterating through an array to total a variable.
e.g. for the total expenses in a month, first an Array:
expenses_this_month = expenses.find :all,
:conditions => ['date >= ? and date <= ?',
Date.today.begin...
I have table A with foreign key to table B in field b_id. Now I'm trying to make view/control for adding new table A entry. In form I have combo box (via collection_select) that lists all the elements from table B and that is where i intend to get the b_id for new instance of A in the create method for A.
Value of the combo box is set t...
For some reason when I run rails command, it installs 2.2.3 version of Rails in /vendor/rails and webbrick uses that version instead of 2.3.5 which is installed as a gem.
If I delete that, then it uses the right directory. I remember using git submodule once, but I don't think that has anything to do with this.
How can I correct this? ...
The Ruby mixin module I'm writing would be useful for both vanilla Ruby and Rails. What's the best practice for determining at run-time whether Rails is loaded? Is it possible to get the version number as well?
In script/console for a Rails 2.3.4 project ENV.has_key?("RAILS_ENV") is true and it's false in my Ruby 1.8.7 interpreter. I...
I can't seem to get heroku to db:push, even though I have installed taps. It doesnt seem to believe me. I also checked and found a folder here: /Library/Ruby/Gems/1.8/gems/taps-0.2.23/
UM4345s-MacBook-Pro:photosite $ sudo gem install taps
Password:
Successfully installed rack-1.1.0
Successfully installed sinatra-0.9.2
Success...
$ rake test
$ rake test
(in /Users/ethan/project/mtc/completestreets)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0.8.7/lib/rake/rake_test_loader.rb"
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"lib:test" "/Library/Ruby/Gems/1.8/gems/rake-0...