Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Dirty attributes use inconsistent accessors for before/after

#3251

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.

Reported by Arya Asemanfar · September 23rd, 2009 @ 05:13 PM

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Jason Gignac
    Jason Gignac

    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?).

    June 24th, 2010 @ 05:18 PM

  2. Arya Asemanfar
    Arya Asemanfar

    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?

    June 24th, 2010 @ 05:26 PM

  3. Santiago Pastorino
    Santiago Pastorino
    • 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.

    February 2nd, 2011 @ 05:01 PM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 05:01 PM