Brian McManus
2009-Jan-20 03:23 UTC
Best Practice for form where the model being modified does not match the models being displayed?
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)? --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---