Thanks Matt, that was the problem. I'll keep the console in mind next
time around... it never occurred to me to try that this time.

The Survey model didn't change. The corrected models are:

survey_question.rb:

class SurveyQuestion < ActiveRecord::Base
  belongs_to :survey
  acts_as_list :scope => :survey

  has_many :survey_possible_answers
end


survey_possible_answer.rb:

class SurveyPossibleAnswer < ActiveRecord::Base
  belongs_to :survey_question
  acts_as_list :scope => :survey_question
end

The migrations and fixture files didn't have to change.

Mark


On Feb 17, 3:46 pm, Matt Jones <[email protected]> wrote:
> The problem: the belongs_to here is going to fail. In the vast
> majority of cases,
> belongs_to should have a singular name. The code here won't ever work,
> as you've
> got the DB field (survey_question_id) named correctly, and it won't
> match.
>
> BTW, tiny typos like this are why I prefer to start by poking at the
> models in console;
> frequently, that will drive the first tests of the models, and if
> you've got a typo it will
> be very apparent...
>
> --Matt Jones
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to