Skip to content
Browse files

fix serialization type cast when value is already unserialized

  • Loading branch information...
1 parent 9c89b29 commit 9041454def79d8e61cabe49e7c5cb72cef29138b @mrbrdo mrbrdo committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/attribute_methods/serialization.rb
View
6 activerecord/lib/active_record/attribute_methods/serialization.rb
@@ -56,7 +56,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 9041454

Please sign in to comment.
Something went wrong with that request. Please try again.