Nested attributes - Unpermitted parameters Rails 4

后端 未结 2 1050
谎友^
谎友^ 2021-01-25 19:33

There is a lot of resources on SO about issues on Nested attributes in Rails 4 regarding strong parameters but I don\'t find any solution on this: (so sorry if it\'s a duplicate

2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-25 20:11

    Try Adding the :member_id inside profile_attributes which is in member_params

    so it will look like this:

    def member_params
          params[:member].permit(:email, profile_attributes: [:first_name, :last_name, :member_id ])
    end
    

提交回复
热议问题