Rails Can't mass-assign protected attributes: phone

freedomwait · March 01, 2014 · Last by ruohanc replied at March 02, 2014 · 2071 hits

提交数据的时候报错:Can't mass-assign protected attributes: phone

之前的数据没有问题,用 scaffold 生成的,后来插入一个 phone:string

然后:rake db:migrate

在网页表单里提交 phone 的数据时就报这种错误了,请教各位错误出在哪里?怎么修改?

附上我的版本:Rails 3.2.13 ruby 1.9.3

找到这个 model,在 arrr_accessible 中增加:phone。

楼主要明白啥叫 mass-assign,这才要紧

正解,,,

You need to Sign in before reply, if you don't have an account, please Sign up first.