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.

serialized :attribute fails when specified in STI subclass

#204

When using STI, if a subclass specifies that an attribute is to be serialized, and that attribute was not specified as serialized in the base class, serialization of the attribute fails.

This bug will only occur in production, not in development mode due to the class reloading in development mode.

class Droid < ActiveRecord::Base

end

class R2D2 < Droid

serialize :secret_message

end

If the R2D2 class is loaded in production after the Droid class is loaded, then the serialization of the secret_message attribute will fail.

Patch and tests attached.

Reported by Wes · May 15th, 2008 @ 10:00 PM

State: stale
Milestone: none
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Pratik
    Pratik
    • Assigned user set to Michael Koziarski

    May 15th, 2008 @ 10:03 PM

  2. josh
    josh
    • State changed from new to stale
    • Tag set to activerecord, bug, patch, serialized, tested

    August 20th, 2008 @ 01:52 AM

  3. Zack Hobson
    Zack Hobson

    This issue is affecting me in Rails 2.3.4, and the included patch fixes it for me (it applies cleanly to tag v2.3.4 using git apply). Any chance this patch can be included in Rails?

    September 7th, 2009 @ 05:32 PM