aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-07 13:39:27 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-07 13:39:27 -0700
commitc6015cbcd8b6ed716c0add2874a17a495250ef0a (patch)
tree006d88d1b93e70dc652827144d9cb2b67ebeb11a /activerecord/lib/active_record/base.rb
parentc8a2dd3caca94ce41f37442512b90343dcbc6161 (diff)
downloadrails-c6015cbcd8b6ed716c0add2874a17a495250ef0a.tar.gz
rails-c6015cbcd8b6ed716c0add2874a17a495250ef0a.tar.bz2
rails-c6015cbcd8b6ed716c0add2874a17a495250ef0a.zip
serialized attributes should be serialized before validation [#5525 state:resolved]
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 21453f5e9a..ef4834811c 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1685,8 +1685,8 @@ MSG
if include_readonly_attributes || (!include_readonly_attributes && !self.class.readonly_attributes.include?(name))
value = read_attribute(name)
- if value && ((self.class.serialized_attributes.has_key?(name) && (value.acts_like?(:date) || value.acts_like?(:time))) || value.is_a?(Hash) || value.is_a?(Array))
- value = value.to_yaml
+ if value && self.class.serialized_attributes.key?(name)
+ value = YAML.dump value
end
attrs[self.class.arel_table[name]] = value
end