Module: ActiveRecord::ConnectionAdapters::PostGIS::Quoting
- Defined in:
- lib/active_record/connection_adapters/postgis/quoting.rb
Instance Method Summary collapse
Instance Method Details
#quote(value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/active_record/connection_adapters/postgis/quoting.rb', line 7 def quote(value) if value.is_a?(RGeo::Feature::Instance) # Convert spatial objects to EWKT format for PostgreSQL if value.srid && value.srid != 0 "'SRID=#{value.srid};#{value.as_text}'" else "'#{value.as_text}'" end else super end end |
#type_cast(value) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/active_record/connection_adapters/postgis/quoting.rb', line 20 def type_cast(value) if value.is_a?(RGeo::Feature::Instance) # Convert spatial objects to EWKT string for parameter binding if value.srid && value.srid != 0 "SRID=#{value.srid};#{value.as_text}" else value.as_text end else super end end |