Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

the typecast value should be passed to the serializer. fixes #10830

  • Loading branch information...
commit 04347540510aff4ce7df2abafcc517de338bd668 1 parent 00ce4b4
@tenderlove tenderlove authored
View
10 activerecord/lib/active_record/attribute_methods/serialization.rb
@@ -56,7 +56,7 @@ def initialize(column)
end
def type_cast(value)
- value.unserialized_value
+ value.unserialized_value @column.type_cast value.value
end
def type
@@ -65,17 +65,17 @@ def type
end
class Attribute < Struct.new(:coder, :value, :state) # :nodoc:
- def unserialized_value
- state == :serialized ? unserialize : value
+ def unserialized_value(v = value)
+ state == :serialized ? unserialize(v) : value
end
def serialized_value
state == :unserialized ? serialize : value
end
- def unserialize
+ def unserialize(v)
self.state = :unserialized
- self.value = coder.load(value)
+ self.value = coder.load(v)
end
def serialize
View
1  activerecord/test/cases/adapters/postgresql/bytea_test.rb
@@ -92,7 +92,6 @@ def dump(str); str; end
end
def test_serialize
- serializer = Serializer.new
klass = Class.new(ByteaDataType) {
serialize :serialized, Serializer.new
}
Please sign in to comment.
Something went wrong with that request. Please try again.