On 15 February 2010 16:27, Max Williams <[email protected]> wrote:
> I have two models, quiz and quiz_question, where quiz_question belongs
> to quiz.  If i change the foreign key, the named association doesn't
> update.  Can i force it to?

You're better off working with Rails, rather than against it, and
instead of setting the foreign key attribute, pass the new object that
you want associated.
instead of
   quiz_question.question_id = 473

do this
   quiz_question.question = Question.find(473)

ActiveRecord will handle the db field updates - that's what it's there
for. You just worry about the objects ;-)

-- 
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