This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Saving objects of multiple types in Rails  RSS feed

 
sinatra roger
Ranch Hand
Posts: 127
  • 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!