Rails 4: accepts_nested_attributes_for and mass assignment
I am trying to reproduce railscast #196 in Rails 4. However, I'm experiencing some problems. In my example I try to generate a Phonebook - each Person could have multiple PhoneNumbers These are important parts of my controller: class PeopleController < ApplicationController def new @person = Person.new 3.times{ @person.phones.build } end def create @person = Person.create(person_params) @person.phones.build(params[:person][:phones]) redirect_to people_path end private def person_params params.require(:person).permit(:id, :name, phones_attributes: [ :id, :number ]) end end and this is my new