search for: define_property_accessors

Displaying 1 result from an estimated 1 matches for "define_property_accessors".

2011 Feb 05
3
ActiveModel::AttributeMethods limiting
In my attempt to add AM:Dirty to my model I realized that AM#AttributeMethods is a bit imperfect. It''s impossible to generate attribute methods step-by-step in DataMapper-like manner. class Model include ActiveModel::Dirty def self.property(name, klass = String) define_property_accessors(name, klass) # This method will be called once, because of https://github.com/rails/rails/blob/master/activemodel/lib/active_model/attribute_methods.rb#L263 define_attribute_methods([name]) end end class Article < Model property :title property :body property :p...