Rails Can't mass-assign protected attributes: phone

freedomwait · 2014年03月01日 · 最后由 ruohanc 回复于 2014年03月02日 · 2070 次阅读

提交数据的时候报错: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,这才要紧

正解,,,

需要 登录 后方可回复, 如果你还没有账号请 注册新账号