Hello all, I'm developing a sinatra application and loads ActiveRecord in, sometimes it will just report warning for mass for attributes, how can I enable it in non-Rails environment? checked in rails code, it's config.active_record.whitelist_attributes = true, so I add to my top code of sinatra ActiveRecord::Base.whitelist_attributes=true but no luck, no such method exists in ActiveRecord::Base, so what's the class of config.active_record, and when setting whitelist_attributes = true, in what point it invokes some method of active_record to make it whitelist_attributes aware? Thanks. Best Regards
on 2012-08-15 12:05
on 2012-08-16 13:40
On Wednesday, 15 August 2012 05:04:44 UTC-5, femto wrote: > setting whitelist_attributes = true, > in what point it invokes some method of active_record to make > it whitelist_attributes aware? > Thanks. > Best Regards > module MyApplication module MyMassAssignmentIncluder extend ActiveSupport::Concern included do attr_accessible(nil) self.mass_assignment_sanitizer = :strict end end end # MyModel < ActiveRecord::Base # include MyApplication::MyMassAssignmentIncluder # end
on 2012-08-19 14:49
Hello, thanks very much. On Wed, Aug 15, 2012 at 10:49 PM, Jordon Bedwell <envygeeks@gmail.com>wrote: >> but no luck, no such method exists in ActiveRecord::Base, > extend ActiveSupport::Concern > # end > > > -- http://hi.baidu.com/femto http://www.aisiming.com/ http://maptu.heroku.com/
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.