RailsCasts Pro episodes are now free!

Learn more or hide this

brunzino's Profile

GitHub User: brunzino

Site: www.nbruns.us

Comments by brunzino

Avatar

Also in Rails 4, remember to add the _destroy method to permitted params. Like this:

surveys_controller.rb
def survey_params
  params.require(:survey).permit(:name, questions_attributes: [:id, :content, :_destroy])
end

you also need to add it in the QuestionsController

questions_controller.rb
def question_params
  params.require(:question).permit(:content, :_destroy])
end