Class: ActiveRecord::ConnectionAdapters::PostGISAdapter::SpatialOID
- Inherits:
-
PostgreSQLAdapter::OID::Type
- Object
- PostgreSQLAdapter::OID::Type
- ActiveRecord::ConnectionAdapters::PostGISAdapter::SpatialOID
- Defined in:
- lib/active_record/connection_adapters/postgis_adapter/rails4/spatial_column.rb
Overview
Register spatial types with the postgres OID mechanism so we can recognize custom columns coming from the database.
Instance Method Summary collapse
-
#initialize(factory_generator_) ⇒ SpatialOID
constructor
:nodoc:.
- #type_cast(value_) ⇒ Object
Constructor Details
#initialize(factory_generator_) ⇒ SpatialOID
:nodoc:
142 143 144 |
# File 'lib/active_record/connection_adapters/postgis_adapter/rails4/spatial_column.rb', line 142 def initialize(factory_generator_) @factory_generator = factory_generator_ end |
Instance Method Details
#type_cast(value_) ⇒ Object
146 147 148 149 |
# File 'lib/active_record/connection_adapters/postgis_adapter/rails4/spatial_column.rb', line 146 def type_cast(value_) return if value_.nil? ::RGeo::WKRep::WKBParser.new(@factory_generator, :support_ewkb => true).parse(value_) rescue nil end |