Permalink
Browse files

fix serialization type cast when value is already unserialized

  • Loading branch information...
1 parent cd0b623 commit ec2b971118daaac06f13d9b416b952a779bc0fb5 @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 ec2b971

Please sign in to comment.