ActiveModel::MassAssignmentSecurity::Error

Posted by Lawrence Sun on 2013-10-07

本来按着agile web development with rails的书,照葫芦画瓢不该有啥问题,结果在create new product时候,ActiveModel::MassAssignmentSecurity::Error 闪亮登场。

错误追踪到product new这行...此时我的解决错误能力为0。果断求助Google,stackoverflow再显神威。

http://stackoverflow.com/questions/6163759/cant-mass-assign-protected-attributes

solution:

put this into app/models/product.rb

attr_accessible :title, :description, :image_url, :price

railscasts is great, mark.