Results 1 to 3 of 3
Jun 17, 2009, 17:27 #1
- Join Date
- Nov 2008
- 0 Post(s)
- 0 Thread(s)
Simply Rails 2 - belongs_to Clause - page 204
I'm following Simply Rails 2 and I am stuck at page 204
I modified the vote.rb file as follows:
class Vote < ActiveRecord::Base
>> v= Vote.find( :first)
=> #<Vote id: 1, story_id: 1, created_at: "2009-06-17 19:20:11", updated_at: "2009-06-17 19:20:11">
NoMethodError: undefined method 'story' for #<Vote:0x3245524>
from C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:205:in 'method_missing'
So using page 162 as a guide (because there was a NoMethodError in Stories#new), the book said the problem is:
we haven't declared Story as a resource anywhere.
resources in Rails are declared in the file responsible for the Routing Configuration, config/routes.rb
ActionController::Routing::Routes.draw do |map|
map.resources : votes
And this didn't solve the problem.
So, what exactly is the solution to this problem?
I tried searching for a solution on Google, also on Google blog search. Is there a site that anyone would recommend for information on dealing with Ruby errors?