ActiveModel::ForbiddenAttributesError when creating new user

后端 未结 7 1819
礼貌的吻别
礼貌的吻别 2020-11-22 15:59

I have this model in Ruby but it throws a ActiveModel::ForbiddenAttributesError

class User < ActiveRecord::Base
  attr_accessor :password
  v         


        
7条回答
  •  时光取名叫无心
    2020-11-22 16:46

    Alternatively you can use the Protected Attributes gem, however this defeats the purpose of requiring strong params. However if you're upgrading an older app, Protected Attributes does provide an easy pathway to upgrade until such time that you can refactor the attr_accessible to strong params.

提交回复
热议问题