My setup:
- Ruby 2.0.0
- Rails 3.2.12
- most recent
pg
gem - most recent
activerecord-postgis-adapter
gem - most recent
rgeo-geojson
gem - Postgres 9.1.6
- PostGIS 2
I've asked something similar a few days ago. (Need to convert a Boolean from Postgres (== String) to a Ruby Boolean). There I had to convert a value from a custom select to boolean. This was pretty straight forward, by just adding this to my model:
def value_name
ActiveRecord::ConnectionAdapters::Column.value_to_boolean(self[:value_name])
end
But now I receive a value of type Point
(which is a type from PostGIS). Its string representation in database looks like "0101000000EE7C3F355EF24F4019390B7BDA011940"
, but it has to become a (I think) RGeo::Feature::Point
or maybe RGeo::Geos::CAPIPointImpl
?!
Now I looked at ActiveRecord::ConnectionAdapters::Column
(http://rubydoc.info/docs/rails/ActiveRecord/ConnectionAdapters/Column), I can only find value_to_boolean
and value_to_decimal
.
Then I recognized that there is also ActiveRecord::ConnectionAdapters::PostgreSQLColumn
(http://rubydoc.info/docs/rails/ActiveRecord/ConnectionAdapters/PostgreSQLColumn), but it doesn't seem to have any useful methods.
Thank you!