• Post Reply Bookmark Topic Watch Topic
  • New Topic

Saving objects of multiple types in Rails  RSS feed

Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, im designing a simple quiz application using rails. The Admin has the option of creating a new question with possible options which can be selected by participants in the quiz.
When "Submit new question" button is clicked, a form opens up with a text area to enter the question description and four other text fields to enter in the possible options. Question has been designed as a model and Option has been designed as another model. So in the form to create the new question, how can the code to save an Option object be written? That is, the form for question starts like this: <%= form_for(@question) do |f| %>

NOw how can an option object be saved from inside the form?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!