Module: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::Quoting

Defined in:
lib/activerecord-postgres-postgis/active_record/connection_adapters/quoting.rb

Instance Method Summary collapse

Instance Method Details

#type_cast_with_spatial(value, column, array_member = false) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/activerecord-postgres-postgis/active_record/connection_adapters/quoting.rb', line 5

def type_cast_with_spatial(value, column, array_member = false)
  if value.kind_of?(RGeo::Feature::Geometry)
    RGeo::WKRep::WKBGenerator.new(hex_format: true, type_format: :ewkb, emit_ewkb_srid: true).generate(value)
  else
    type_cast_without_spatial(value, column, array_member)
  end
end