To do a special kind of validation in an ActiveRecord-based model I need to manually do the update_attributes-steps:
load(params) && save
But when I try to call “load” on my Model’s instance (mymodel.load(params)) it calls “load” on ActiveSupport, trying to load a file.
Is there a way to tell Rails to use the ActiveRecord-method?
Thanks!
Regards
Marc
I think you want the
assign_attributemethod ofActiveRecord::Base.I’m using Rails 3.1.3, but hopefully this is correct for you.
The
update_attributessource you pasted belongs toActiveResource::Base, not toActiveRecord::Base. I just made that mistake myself: Is it possible to call ActiveResource::Base#load?ActiveRecord::Basedoes not supply aloadmethod. Instead theloadmethod ofObjectis called, which appears to be supplied by ActiveSupport’sLoadablemodule inactivesupport-3.1.3/lib/active_support/dependencies.rb.