All threads / Survey - adding options though nested models

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Survey - adding options though nested models

Chris Ma asked in General

Hey guys, a while ago, I tried to follow a railscast tutorial(notably http://railscasts.com/episodes/197-nested-model-form-part-2?view=asciicast) on nested models where i was trying to build a survey platform where admins could log in an build survey in a very Survey Monkey manner. I'm a bit lost at how this adds questions and gets saved(I dont get how whenever I add questions, it knows where to save the data), could someone explain what actually happens? Also is there a better way to address the same issue now?
Cheers,
Chris

There's an updated version of that screencast here: http://railscasts.com/episodes/196-nested-model-form-revised

That is also outdated, but it's all still useful. Instead of using attr_accessible, you'll have to use strong parameters in your controller. Remember to add question_ids: [].

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 37,344+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.