This project is archived and is in readonly mode.
serialized :attribute fails when specified in STI subclass
Reported by Wes | May 15th, 2008 @ 10:00 PM
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.
Comments and changes to this ticket
-
Pratik May 15th, 2008 @ 10:03 PM
- Assigned user set to Michael Koziarski
-
josh August 20th, 2008 @ 01:52 AM
- State changed from new to stale
- Tag set to activerecord, bug, patch, serialized, tested
-
Zack Hobson September 7th, 2009 @ 05:32 PM
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?
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
- 3169 Attributes are not serialized in STI subclasses in production mode. This was originally reported and patched by Les Hill: htt...