This project is archived and is in readonly mode.
Move ActiveModel::AttributeMethods#attribute_methods_generated? to ActiveRecord
Reported by wildchild | February 13th, 2011 @ 05:47 PM
In order to add ActiveModel::Dirty to models, people should use AttributeMethods. Everything is cool with AR-like models, but consider model like this:
class Article < Model
property :title
property :body
property :published_at, Time
end
Currently we should use AttributeMethods#define_attribute_methods([:title, :body, :published_at]). In this DataMapper-like model it's impossible to determine all properties or find a nice workaround. Also, we can't call #define_attribute_methods multiple times, because it does nothing if #attribute_methods_generated? is positive.
My patch moves all this #attribute_methods_generated? tracking to ActiveRecord. Also #define_attribute_method added. All AR tests passes, Am test modified. Yeah, there is no backward compatibility, but it's pretty simple to override AM behavior just like it done for AR (see patch for details).
Comments and changes to this ticket
-
wildchild February 20th, 2011 @ 04:10 PM
- Tag changed from active model, active record to active model, active record, patch
-
José Valim March 1st, 2011 @ 06:23 PM
- Importance changed from to Low
I cannot apply it. Please rebase?
-
Repository March 1st, 2011 @ 07:32 PM
- State changed from new to resolved
(from [24faddd60c5fd148c8264898aeca2d5f36b25a4b]) Move ActiveModel::AttributeMethods#attribute_methods_generated? to ActiveRecord, so it's flexible now
[#6428 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
https://github.com/rails/rails/commit/24faddd60c5fd148c8264898aeca2...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 6428 Move ActiveModel::AttributeMethods#attribute_methods_generated? to ActiveRecord [#6428 state:resolved]