Hi, I have 2 models: Question, Answer Question has_many Answers ans Answer belong_to a Question How I use this in a search? I''m trying something like @questions.answers... how I do it? Thank you -- Pedro C. Valentini pedro-p14LI7ZcAE/pVLaUnt/cCQC/G2K4zDHf@public.gmane.org +55 (21) 8708-8035
> I have 2 models: Question, Answer > Question has_many Answers ans Answer belong_to a Question > How I use this in a search? > I''m trying something like @questions.answers... how I do it?I''m not sure I understand what you''re trying to do. Are you trying to search for a certain answer for a particular question? What kind of search are you doing? Duane Johnson (canadaduane)
Pedro Valentini wrote:> > Hi, > I have 2 models: Question, Answer > Question has_many Answers ans Answer belong_to a Question > How I use this in a search? > I''m trying something like @questions.answers... how I do it? > > Thank you >Maybe something like... @questions.each { |question| .... print question .... question.answers.each { |answer| .... print answer .... } } -Sam Pohlenz