rails保存危险属性错误

时间:2013-09-07 07:29:18

标签: ruby-on-rails activerecord refinerycms

我收到以下错误

我用几个字段创建了一个新的脚手架出价

当我尝试访问localhost:3000 / bid / new

我收到以下错误

ActiveRecord::DangerousAttributeError in BidsController#new

save is defined by ActiveRecord

在服务器端我看到了这个结果:

Started GET "/bids/new" for 127.0.0.1 at 2013-09-07 12:52:43 +0530
Processing by BidsController#new as HTML
Refinery::Role Load (0.4ms)  SELECT "refinery_roles".* FROM "refinery_roles" WHERE "refinery_roles"."title" = 'Refinery' LIMIT 1
Refinery::User Load (0.3ms)  SELECT "refinery_users".* FROM "refinery_users" INNER JOIN "refinery_roles_users" ON "refinery_users"."id" = "refinery_roles_users"."user_id" WHERE "refinery_roles_users"."role_id" = 1
Completed 500 Internal Server Error in 779ms

ActiveRecord::DangerousAttributeError (save is defined by ActiveRecord):
  app/controllers/bids_controller.rb:27:in `new'
  app/controllers/bids_controller.rb:27:in `new'

我缺少什么或是在/是覆盖函数的refinerycms?

请帮帮我

2 个答案:

答案 0 :(得分:1)

看来,你已经定义了一些保留的ActiveRecord属性,如果你这样做了,你要么必须改变它们,要么尝试别的东西。只需在gemfile中添加一个gem,gem就会自动处理名称冲突。

gem 'safe_attributes'
希望它会有所帮助。谢谢。

答案 1 :(得分:1)

我已经解决了我的问题,

问题不在于炼油厂cms

我创建了一个名为save的字段:boolean

我将它更改为save_x:boolean,现在它可以正常工作