diff --git a/lib/spatial_adapter/postgresql.rb b/lib/spatial_adapter/postgresql.rb index 21fed1b..f8199fa 100644 --- a/lib/spatial_adapter/postgresql.rb +++ b/lib/spatial_adapter/postgresql.rb @@ -33,6 +33,14 @@ def native_database_types super.merge(geometry_data_types) end + def type_cast(value, column) + if value.kind_of?(GeoRuby::SimpleFeatures::Geometry) + value.as_hex_ewkb + else + super + end + end + #Redefines the quote method to add behaviour for when a Geometry is encountered def quote(value, column = nil) if value.kind_of?(GeoRuby::SimpleFeatures::Geometry)