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.

serialize_fields not recording changes

#3464
class Model < ActiveRecord::Base
  serialize :extra_data, Hash
end

m = Model.new
m.extra_data[:test] = 'test'
m.changed
=> []

I also find that models that use serialize fields will update those fields on every save of the model, whether the fields have changed or not. (I assume this is related to the serialize fields not recording changes)

Rails 2.3.4

Reported by Adam S · November 5th, 2009 @ 06:22 PM

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

Activity

  1. Matt Jones
  2. Adam S
    Adam S

    Matt,
    Thanks for the links.

    I'm looking at the patch for #2764 Supporting partial updates for serialized columns... It actually seems like the way to go about it. The data is serialized, so the only thing you can depend on is that the data should be the same when converted to yaml... if the data is the same in yaml, then the object hasn't changed. Simple.

    Really that is a great and obvious way to fix this issue.

    There are problems with converting various Object types to yaml, but that isn't rails' problem.

    Can we get that patch looked at again?

    I'm happy to rework it so that it applies against edge and Rails 2.3

    November 9th, 2009 @ 12:38 AM

  3. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to stale
    • Importance changed from to

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

    October 6th, 2010 @ 06:32 AM