Rob Lacey wrote: > I'd say the best way to deal with this is never validate for a > association_id > > #validates_presence_of :question_id > validates_presence_of :question > > would be better.
Hi Rob! I played with this already, and got a surprising result: >>@question = Question.new(attributes) =><a question> >>@grading = @question.gradings.build(other_attributes) =><a grading> >>@grading.question =>nil This surprised me because i thought that the use of build set up the association both ways, ie in both objects, so that even though @grading had no question_id it 'knew' that it was associated with @question. I must admit that this aspect of rails (ie associations that have been built but not saved yet) is something that i've always found a bit magical and hence unpredicatable. -- Posted via http://www.ruby-forum.com/. -- 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.

