Skip to content

Commit

Permalink
Introduce type_cast for our postgres adapter, cutting our failures do…
Browse files Browse the repository at this point in the history
…wn to 24 from 46
  • Loading branch information
Empact committed Aug 15, 2011
1 parent 9a2a657 commit 8fa78c9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/spatial_adapter/postgresql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8fa78c9

Please sign in to comment.