This project is archived and is in readonly mode.
Dirty attributes use inconsistent accessors for before/after
Reported by Arya Asemanfar | September 23rd, 2009 @ 05:13 PM
The dirty attributes hash accesses the original value using read_attribute and uses send(attr) for the current value.
This leads to inconsistencies when an attribute's accessor/writer is overwritten and some sort of serialization is performed before it's put in the attributes hash. The original value will be the serialized value and the current value will be unserialized.
Comments and changes to this ticket
-
Jason Gignac June 24th, 2010 @ 05:18 PM
As far as I'm concerned, this is expected behaviour? When I access the current value, by calling, say 'this_field', there is an implicit understanding that if I've overwritten the accessor with a serializer or somesuch, that it will use that. If I access the old value, I am not accessing the objects behaviour, but an old record of it's state - I am peeking under the covers, as it were. Just my two cents, but I could see the argument you're making. Just, to me, I understand that when I go to the dirty data, there are simply too many dependencies for the objet to act through the serializer I built (what if the serializer, for instance, draws on another field? Which version of the field should it use, the current or the dirty version?).
-
Arya Asemanfar June 24th, 2010 @ 05:26 PM
I can understand not wanting to have the old value be in the unserialized form, but why can't the new value be the raw value as well?
-
Santiago Pastorino February 2nd, 2011 @ 05:01 PM
- State changed from new to open
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 05:01 PM
- State changed from open to stale
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>