阅读背景:

“警告:不能批量分配受保护属性”

来源:互联网 

I have used RESTful techniques to generate a model (in fact, I am using Devise gem, which does that for me), and I have added new fields called first_name and last_name to the model. Migration went fine. I added attr_accessor :first_name, :last_name to the model and expected it would just work. But when I try to mass-assign new instances with Doctor.create({:first_name=>"MyName"}) etc., I am getting errors saying I can't mass-assign protected attributes. I have used RESTful techniques to generate a mo




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: