Ruby on rails Money Rails-简单表单输入

Ruby on rails Money Rails-简单表单输入,ruby-on-rails,money-rails,Ruby On Rails,Money Rails,我正在使用money rails gem来存储我的一个模型的制造成本 在我的模型中,我有- monetize :cost_of_manufacturing_cents 在简单表单的_form.html视图中: f.input :cost_of_manufacturing 但是,当我运行item/new route时,我得到以下错误 undefined method `cost_of_manufacturing' for #<Item:0x007fe34a5feaf8> 未定义的

我正在使用money rails gem来存储我的一个模型的制造成本

在我的模型中,我有-

monetize :cost_of_manufacturing_cents
在简单表单的_form.html视图中:

f.input :cost_of_manufacturing
但是,当我运行item/new route时,我得到以下错误

undefined method `cost_of_manufacturing' for #<Item:0x007fe34a5feaf8>
未定义的方法“制造成本”#

如何解决此问题?

显而易见,但是,您是否运行了迁移并重新启动了服务器?它在控制台中工作吗?如果运行rails s,那么i=Item.new,i.cost\u of_manufacturing??我做到了。当我运行I.cost_of_manufacturing时,我得到了一个错误命名错误:未定义方法'cost_of_manufacturing';我想我遇到了问题,我的初始值设定文件有问题。谢谢你抽出时间!