ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes

前端 未结 6 1250
一个人的身影
一个人的身影 2020-12-14 01:56

If I try to execute the following code:

hassle = rota.hassles.create(:sender => user1, :receiver => user2, :type => \"sms\")

I oba

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-14 01:58

    1. Please try: open config/application.rb

    2. Locate the line of config.active_record.whitelist_attributes = true

    3. Change true to false

    Then you shall be fine.

    PS: remember to restart the rails console.

提交回复
热议问题