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

        define_attribute_methods([name])     end end

class Article < Model     property :title     property :body     property :published_at, Time end

In the above example, attribute methods will be defined just for :title. I don't see any nice workaround.

So what is the purpose of AttributeMethods#attribute_methods_generated? I can't imagine any use case for this. What about removing it entirely and providing #define_attribute_method(s) with ability to call it multiple times? Am I missing something?

Hey Alex, if you want go ahead and try a fix ;).

Done. Ticket with patch #6428 Move ActiveModel::AttributeMethods#attribute_methods_generated? to ActiveRecord - Ruby on Rails - rails

Could anyone take a look at this ticket? https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/6428