Ruby on rails ActiveModel::即使在I';我已将所有属性添加到强参数中
我的应用程序出现此错误 ActiveModel::禁止属性错误 我使用的是gem'activeadmin',github'activeadmin',gem'rails',4.1.7' 即使列出的所有属性都包含在我的活动管理模型的强参数中 模型 错误 有什么帮助吗 更新 起初,我认为是生日导致了错误(它包含3个参数,而不是1个)。Ruby on rails ActiveModel::即使在I';我已将所有属性添加到强参数中,ruby-on-rails,activeadmin,Ruby On Rails,Activeadmin,我的应用程序出现此错误 ActiveModel::禁止属性错误 我使用的是gem'activeadmin',github'activeadmin',gem'rails',4.1.7' 即使列出的所有属性都包含在我的活动管理模型的强参数中 模型 错误 有什么帮助吗 更新 起初,我认为是生日导致了错误(它包含3个参数,而不是1个)。 但我也有一个不同的资源,里面也有出生日期,它实际上起了作用。我在许可证参数声明上有一个打字错误。我刚刚去掉了等号 错: 正确的: 谢谢@nistvanRails 4使用
但我也有一个不同的资源,里面也有出生日期,它实际上起了作用。我在许可证参数声明上有一个打字错误。我刚刚去掉了等号 错: 正确的:
谢谢@nistvanRails 4使用强_参数,因此这可能会对您有所帮助。这就是全部错误,对吗?您不需要在permit_参数后加等号。@nistvan谢谢!成功了!
ActiveAdmin.register User do
permit_params = :prefix, :firstname, :lastname, :password, :email, :membership_code, :birthdate, :contact_number, :location, :active, :confirmed, :remember_token, :town, :province
Request
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"xVA04SdSTDLrwC088FCTRm9fr62z+fgs6wJc0yNn/NU=",
"user"=>{"prefix"=>"mzxklmcklzmklMAKMDAKLSDMASKLDM",
"firstname"=>"KLMSDKMSADKLAMS",
"lastname"=>"MKDSMFKSLDMFK",
"password"=>"[FILTERED]",
"email"=>"KLMFDKDSMFKLSDMFKL",
"membership_code"=>"MKDFSMKLSDMFK",
"birthdate(1i)"=>"2009",
"birthdate(2i)"=>"2",
"birthdate(3i)"=>"1",
"contact_number"=>";WE,
LA;SD,
",
"location"=>",
LDSF,
LSDF,
SL;",
"active"=>"1",
"confirmed"=>"1",
"remember_token"=>"DSL;FSDFL",
"town"=>"FDMSKLFM",
"province"=>"FMSDFLKS"},
"commit"=>"Create User"}
permit_params = :prefix, :firstname, :lastname, :password, :email, :membership_code, :birthdate, :contact_number, :location, :active, :confirmed, :remember_token, :town, :province
permit_params :prefix, :firstname, :lastname, :password, :email, :membership_code, :birthdate, :contact_number, :location, :active, :confirmed, :remember_token, :town, :province