lib/armg/mysql_geometry.rb in armg-0.8.0 vs lib/armg/mysql_geometry.rb in armg-0.8.1

- old
+ new

@@ -4,22 +4,30 @@ class MysqlGeometry < ActiveModel::Type::Value def type :geometry end + def binary? + true + end + def deserialize(value) - if value.is_a?(::String) + case value + when ::String Armg.deserializer.deserialize(value) + when ActiveModel::Type::Binary::Data + Armg.deserializer.deserialize(value.to_s) else value end end def serialize(value) if value.nil? nil else - Armg.serializer.serialize(value) + value = Armg.serializer.serialize(value) + ActiveModel::Type::Binary::Data.new(value) end end end end