Permalink
Browse files

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

  • Loading branch information...
1 parent 00ce4b4 commit 04347540510aff4ce7df2abafcc517de338bd668 @tenderlove tenderlove committed Jun 5, 2013
@@ -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
@@ -92,7 +92,6 @@ def dump(str); str; end
end
def test_serialize
- serializer = Serializer.new
klass = Class.new(ByteaDataType) {
serialize :serialized, Serializer.new
}

0 comments on commit 0434754

Please sign in to comment.