Forum: Ruby on Rails Best Practice for form where the model being modified does not match the models being displayed?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bd75fa9879dc67a44461f53ab38e7d62?d=identicon&s=25 Brian McManus (Guest)
on 2009-01-20 10:57
(Received via mailing list)
Sorry for the long title...

I was just wanting to make sure I'm close to on the right track with
this before I get to far.  Say you have a view that's displaying some
models that are not to be edited in a form that edits a model  behind
the scenes to save data.  Is using normal form_tag rather than the
model helper versions the best/only thing to do?

Specifically I'm working on a quiz app and I need to display a
question (Question model) with some answers (Answer models) and I need
to save the user's answer into another has_many :through model (e.g.
UsersAnswers) associating a User to their Answer.

Another related question... I'm trying to be restful so the question
is displayed by the QuestionsController show method but where would
the put/update for when they answer point to?  Should there be another
controller for the UsersAnswers model that this form submits back to
rather than to the QuestionsController?  Another question is should
the question be displayed by QuestionsController.show in the first
place since there's a form involved and thus "editing" (even though
it's of another related model)?
This topic is locked and can not be replied to.