Module: ActiveRecord::ConnectionAdapters::PostGIS::Quoting

Included in:
ActiveRecord::ConnectionAdapters::PostGISAdapter
Defined in:
lib/active_record/connection_adapters/postgis/quoting.rb

Instance Method Summary collapse

Instance Method Details

#lookup_cast_type(sql_type) ⇒ Object

NOTE: This method should be private in future rails versions.

Hence we should also make it private then.

See github.com/rails/rails/blob/v8.1.1/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb#L190



20
21
22
23
24
25
26
27
28
29
# File 'lib/active_record/connection_adapters/postgis/quoting.rb', line 20

def lookup_cast_type(sql_type)
  type_map.lookup(
    # oid
    query_value("SELECT #{quote(sql_type)}::regtype::oid", "SCHEMA").to_i,
    # fmod, not needed.
    nil,
    # details needed for `..::PostGIS::OID::Spatial` (e.g. `geometry(point,3857)`)
    sql_type
  )
end

#type_cast(value) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/active_record/connection_adapters/postgis/quoting.rb', line 7

def type_cast(value)
  case value
  when RGeo::Feature::Instance
    value.to_s
  else
    super
  end
end