Search code examples
ruby-on-railsactiverecordrefinerycms

rails save dangerous attribute srror


I'm getting the following error

i created a new scaffold bid with few fields

when i tried to access localhost:3000/bids/new

i get following error

ActiveRecord::DangerousAttributeError in BidsController#new

save is defined by ActiveRecord

in server side i see this result:

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'

what am i missing or is refinerycms mounted at / is overriding functions?

please help me


Solution

  • It Seems, you have defined some reserved ActiveRecord's attributes, If you did so, than you either have to change those or try something else. Just add a gem in your gemfile and the gem will take care of name collisions automatically.

    gem 'safe_attributes'
    

    hope it will help. Thanks.