Displaying 1 result from an estimated 1 matches for "accessiblemodelattributes".
2008 Nov 01
0
Overloading #initialize in a model
...f => ''asdf''
What I''d like to do is, in the Person model, modify the hash of
attributes before they''re set. This is what I came up with:
class Person < ActiveRecord::Base
attribute_accessible :name
def initialize(attribs = {})
attribs_that_exist = AccessibleModelAttributes.extract self.class,
attribs
super attribs_that_exist
end
end
Am I on the right track? Cheers,
Nick
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, sen...