Permalink
Browse files

fix serialization type cast when value is already unserialized

  • Loading branch information...
1 parent b4d2943 commit 480b28bd8ee3d1f791be7b41ae32b8859cae153d @mrbrdo mrbrdo committed with tenderlove Jun 5, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/attribute_methods/serialization.rb
@@ -63,7 +63,11 @@ def initialize(column)
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

0 comments on commit 480b28b

Please sign in to comment.