RailsCasts Pro episodes are now free!

Learn more or hide this

Dan Esposito's Profile

GitHub User: danesposito

Comments by Dan Esposito

Avatar

I got stuck on the params.require/permit (Rails 4.2.4).

Note: my models have different fields than in the video example, but the nested permit structure for attributes should help you out. Notice how the answers_attributes is located inside the questions_attributes .

This is what wound up working for me

ruby
def survey_params
      params.require(:survey).permit(:name, questions_attributes: [:id, :content, :number, :_destroy, answers_attributes: [:id, :answertext, :score, :_destroy]])
    end