dazuma/rgeo — Issue #20: set_rgeo_factory_for_column does not seem to be working
Author: jackquack
Created: 2012-01-15 03:24:13+00:00
State: open

I'm working with:
--Rails 3.1
--activerecord-postgis-adapter 0.4.0
--rgeo 0.3.3 (I also tried 0.3.2)

#In 'class Post < ActiveRecord::Base'
set_rgeo_factory_for_column(:location,
RGeo::Geographic.spherical_factory(:srid => 4326))

post = Post.create(:location => "POINT(45,45)")
post.location #returns nil
post.location = "POINT(45,45)" #returns "POINT(45,45)"
post.location #returns nil

factory = RGeo::Geographic.spherical_factory(:srid => 4326)
post.location = factory.point(45,45) #returns #
post.location #returns #

So, it seems like my location point will silently not accept the WKT string as a point. I am forced to create a point and store it manually. I believe this is the exact functionality that set_rgeo_factory_for_column is supposed to take care of.

(Here is the exact code irb session. http://pastebin.com/Rc5Uf9Xg )