[Rails] 'Has Many' in one View form?

D Roberts webmanager at aibs.org
Sun Apr 9 18:43:08 GMT 2006


Hello,

Any help much appreciated.  I've got a controller with @questions, which 
is an array of ProjectsQuestion model objects.

I've got @answers as well, which is an array of Answer model objects, 
which are new and don't exist in the database yet.

For my view I want one form which lists each ProjectsQuestion followed 
by a textarea field where a Person can provide their Answer for that 
Question and a date which is stored with the Person.

Can anyone suggest an approach for the view and form post action to 1) 
make the form I specified above, and 2) process/store the many answers a 
person submits?  I'm having trouble with several things including id's 
in the answer textareas for the many ansers a person gives (~7), 
looping, ie: "for @question in @questions" doesn't give me an easy way 
to access @answers, and more.

Thanks and I'm happy to provide more details...

All Best!

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list