aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Berdajs <mrbrdo@gmail.com>2013-06-05 18:08:33 +0200
committerJan Berdajs <mrbrdo@gmail.com>2013-06-05 18:08:33 +0200
commit9041454def79d8e61cabe49e7c5cb72cef29138b (patch)
tree64f05289bc901dd660df0901b0f9549bc49ace06
parent9c89b29138b02e257ab3c058744eb7f9970c759d (diff)
downloadrails-9041454def79d8e61cabe49e7c5cb72cef29138b.tar.gz
rails-9041454def79d8e61cabe49e7c5cb72cef29138b.tar.bz2
rails-9041454def79d8e61cabe49e7c5cb72cef29138b.zip
fix serialization type cast when value is already unserialized
-rw-r--r--activerecord/lib/active_record/attribute_methods/serialization.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb
index 9caf73e627..1287de0d0d 100644
--- a/activerecord/lib/active_record/attribute_methods/serialization.rb
+++ b/activerecord/lib/active_record/attribute_methods/serialization.rb
@@ -56,7 +56,11 @@ module ActiveRecord
end
def type_cast(value)
- value.unserialized_value @column.type_cast value.value
+ if value.state == :serialized
+ value.unserialized_value @column.type_cast value.value
+ else
+ value.unserialized_value
+ end
end
def type