Permalink
Browse files

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

  • Loading branch information...
1 parent e312246 commit a833467065a6e68d0f86a625cf8bf296b669f759 @tenderlove tenderlove committed Jun 5, 2013
@@ -63,7 +63,7 @@ def initialize(column)
end
def type_cast(value)
- value.unserialized_value
+ value.unserialized_value @column.type_cast value.value
end
def type
@@ -72,17 +72,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 a833467

Please sign in to comment.