aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorRaimonds Simanovskis <raimonds.simanovskis@gmail.com>2011-02-09 13:11:06 +0200
committerAaron Patterson <aaron.patterson@gmail.com>2011-02-09 09:19:56 -0800
commitc567ccbb1738969345b29297e40a9aee87a97391 (patch)
tree7510e1521643180ddd8ec4aee1af96e527f16c75 /activerecord/lib/active_record
parentf48d32c0cff36cb505443ff72738def3a82c2886 (diff)
downloadrails-c567ccbb1738969345b29297e40a9aee87a97391.tar.gz
rails-c567ccbb1738969345b29297e40a9aee87a97391.tar.bz2
rails-c567ccbb1738969345b29297e40a9aee87a97391.zip
bugfix for serialized_attributes to be class specific
previously serialized_attributes were kept as class attribute of ActiveRecord::Base - if some attribute was defined as serialized in one subclass then it was serialized in all other subclasses as well (if it had the same name)
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 2d5c166075..16bdd7bb58 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -553,7 +553,9 @@ module ActiveRecord #:nodoc:
Coders::YAMLColumn.new(class_name)
end
- serialized_attributes[attr_name.to_s] = coder
+ # merge new serialized attribute and create new hash to ensure that each class in inheritance hierarchy
+ # has its own hash of own serialized attributes
+ self.serialized_attributes = serialized_attributes.merge(attr_name.to_s => coder)
end
# Guesses the table name (in forced lower-case) based on the name of the class in the