This project is archived and is in readonly mode.
[PATCH] Restore changed_attributes method in ActiveModel::Dirty
Reported by Sam Pohlenz | April 1st, 2010 @ 12:01 PM | in 3.0.2
It seems that
this commit removed the changed_attributes
method
from ActiveModel::Dirty, which lazily loaded the
@changed_attributes ivar.
This then required
another commit to ensure that the necessary ivars are
initialized. However this still has the major drawback of requiring
the including class to call super
in its
initialize
method (depending on the inclusion order).
This should not be necessary.
This patch restores the changed_attributes
method.
It is simpler, it uses a common pattern and removes these specific
undocumented requirements on the including code.
Comments and changes to this ticket
-
Jeremy Kemper April 1st, 2010 @ 03:23 PM
- State changed from new to wontfix
Calling super is normal, not a drawback. Using an ivar for localized implementation is simple; lazy loading for initialization is unnecessary when initialize is at our disposal.
-
Sam Pohlenz April 2nd, 2010 @ 12:52 AM
Adding a one-line method (and removing initialize) is simpler than requiring that the including class always call super within its initialize method. Why push this responsibility to the implementer when it is trivial to take care of it in ActiveModel?
Furthermore, with these previous commits, ActiveModel::Dirty is now the only part of AM to require that super is called within initialize, not to mention that this requirement is now undocumented.
-
Jeremy Kemper April 2nd, 2010 @ 01:51 AM
- State changed from wontfix to open
- Milestone cleared.
Good point and a fine reason to lazy-initialize. Sorry for glossing over that!
-
Repository April 2nd, 2010 @ 01:58 AM
- State changed from open to committed
(from [3adaef8ae73a3061a9fe4c5e0256d80bc09b1cf4]) Restore changed_attributes method in ActiveModel::Dirty and loosen expectation on including class' initialize method.
[#4308 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/3adaef8ae73a3061a9fe4c5e0256d8... -
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
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
Tags
Referenced by
- 4308 [PATCH] Restore changed_attributes method in ActiveModel::Dirty [#4308 state:committed]