environment/cucumber.rb:
...
# gem dependencies
config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.0' unless File.directory?(File.join(Rails.root, 'vend
config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vend
config.gem 'webrat', :lib => false, :versi...
I'm playing around with MongoMapper but I'm having trouble figuring out how to create a form for an object that has embedded documents.
With ActiveRecord, I'd use fields_for but when asked if this would be supported a few months ago, MongoMapper author John Nunemaker wrote: "Nope and nope. It is really [not] that hard with attr_accessor...
I'm having a lot of trouble trying to define a mock for a rails models on cucumber. It seems like the method is creating a bunch of message expectations and i keep getting errors like these:
Given I have only a product named "Sushi de Pato" # features/step_definitions/product_
steps.rb:19
unexpected invocation: #<Mock:ProductCate...
Hello,
I am starting to learn the benefits of memcache, and would like to implement it on my project. I have understood most of it, such as how data can be retrieved by a key and so on.
Now I get it that I can put a post with all of its details in memcache and call the key POST:123, that is OK, and I can do it for each post.
But how t...
I have 2 tables product and history
product table:
id name type price location
1 abc electronics $200 aisle1
history table:
id product_id status
1 1 price changed from $200 to $180
Whenever the product price or location is updated by a user by hitting the update button, ...
I have ruby on rails installed on my ubuntu 8.10 desktop. Script/generate came up with this error.
# script/generate
undefined method `index' for #<Enumerator: "Rails Info:":each_line>
any ideas?
Thanks for you help,
zeem
...
So I'm building a rails app for high school students and I've hit a problem when it comes to creating users.
I want the students to only be able to create accounts if they select their school and type in their school's password correctly.
What is the correct / easiest way of doing this? Should I create a gatekeeper to the user#new acti...
Hi,
I'm a newbie to Rails and am starting a new project that uses AuthLogic. I'm just a little confused about whether AuthLogic provides everything I need to store session state, or whether I still have to include the Rails mechanism (rake db:sessions:create).
Thanks!
Tim
...
I have two models: Person and Address which I'd like to create in a transaction. That is, I want to try to create the Person and, if that succeeds, create the related Address. I would like to use save semantics (return true or false) rather than save! semantics (raise an ActiveRecord::StatementInvalid or not).
This doesn't work because ...
I am having trouble with this association.
I need to get an array of the primaries that belong to the soldiers in a platoon. So once I get all the soldiers in a platoon:
@company = Company.find_by_id(1)
@platoons = @company.platoons
<% @platoons.each do |p| %>
<%= p.soldiers.primaries.find(:all,:conditions => ["relationship =...
I want to add additional criteria to the LEFT OUTER JOIN generated by the :include option in ActiveRecord finder.
class Post
has_many :comments
end
class Comment
belongs_to :post
has_many :comment_votes
end
class CommentVote
belongs_to :comment
end
Now lets say I want to find last 10 posts with their associated comments an...
I'm creating a Rails app for students and high schools and I'm having some trouble with my User.rb.
I want to have a user model to be used for logging in, but having that user have many roles. The tricky part is that I want users that have a student role to have_one student page, and those that have a role of principal to have_one hi...
On my server I am unable to run mongrel_rails start. I looked in /usr/bin/ and could not locate the mongrel_rails file. Instead I found it in /var/lib/gems/1.8/bin. The file includes #!/usr/bin/ruby1.8, but I am still not getting this to work.
...
I have a database full of text fields that look like this:
(paragraph of normal text)
image:blog/clownboy.jpg
(another paragraph)
I'm trying to write a view helper for Rails that will take one of these big blocks of text, find bits like "image:blog/clownboy.jpg" and replace them with the corresponding <img src="blog/clownboy.jpg"> (...
hello,
i want to learn rails and as a project to learn rails i came across webquests. what a webquest is is clearly written here1 and this is a example how a webquest look like.
i started with script/generate nifty_scaffold introduction index and repeat this for every section like task , Process, Evaluation and so on. but i dont think ...
Lets say I have a food model
in the model, every day, people enter how many lbs of pizza/vegetables/fruit they eat.
each food is its own column
my issue is, I'd like it so they can only enter that in once (for that food type) every 24 hours (based on created_at).
This possible?
...
I'm trying to follow this post http://stackoverflow.com/questions/576240/how-can-i-unobtrusively-disable-submit-buttons-with-javascript-and-prototype but I can't get it to work. The form triggers an RJS function, so I need to keep the helpers' onclick events intact. The RJS returns/reloads the same forms along with two new texts. I'm r...
I'm trying to write a rails application where users can upload images, but Paperclip doesn't seem to be working for me.
I've gone through all the basic steps (added has_attached_file, the migration, making the form multipart) but I keep getting the same error whenever I try uploading an image:
can't convert nil into Integer
Lookin...
I'm looking for a simple telephony API for use with Rails application. The application must be able to make a notification call through the API and receive confirmation code from the dialpad.
...
I have three models: User, RaceWeek, Race.
Current associations:
class User < ActiveRecord::Base
has_many :race_weeks
end
class RaceWeek < ActiveRecord::Base
belongs_to :user
has_many :races
end
class Race < ActiveRecord::Base
belongs_to :race_week
end
So the user_id is a foreign key in RaceWeek and race_week_id is a foreig...