I\'m trying to get my backbone associations working inside a rails app , and I\'m having difficulty when trying to update existing models. Specifically, Rails throws the followi
For those who are Googling...
While the current accepted answer certainly works, the following was how I worked out my problem (very similar, but slightly different):
I was using a nested form, with models nested 4 layers deep. In my controller which was rendering the form, I needed to build out the form.
def new
@survey = Survey.new
3.times do
question = @survey.questions.build
4.times { question.answers.build }
end
end
This allowed the params to include params[:survey][:questions_attributes]
. Rails renamed the parameters for me because I informed it ahead of time.
Hope this helps!