NoMethodError: undefined method `set_rgeo_factory_for_column'

316 views
Skip to first unread message

Anuj

unread,
Jun 14, 2015, 8:15:41 PM6/14/15
to rgeo-...@googlegroups.com
Apologies if this is very newbie question, but I have tried to solve it for a couple of days with zero luck.

I tried installing activerecord-postgis-adapter as per the README but am unable to create the model instance as I keep getting the error mentioned below on the code pasted below that.
NoMethodError: undefined method `set_rgeo_factory_for_column'

Here are what my different files look like:

Location.rb (the model)
#self.rgeo_factory_generator = RGeo::Geos.factory_generator
 set_rgeo_factory_for_column
(:coordinates,
 
RGeo::Geographic.spherical_factory(:srid => 4326) )

Console
irb(main):001:0> loc = Location.create
NoMethodError: undefined method `set_rgeo_factory_for_column' for Location



Gemfile
gem 'rgeo'
gem
'rgeo-activerecord'
gem
'activerecord-postgis-adapter'

config/application.rb
require 'rails/all'
#require 'active_record/connection_adapters/postgis_adapter/railtie'
#require "#{Rails.root}/lib/rgeo"

config/database.yml
development:
 
<<: *default
  database
: geoproject-api_development
  adapter
: postgis
  schema_search_path
: "public,postgis"


The lines of code commented above refer to the solutions I tried based on what was mentioned in various threads but didn't work for me.

I am using Rails 4.2.1.

Any help would be much appreciated!

Myles Boone

unread,
Mar 16, 2016, 11:55:10 AM3/16/16
to RGeo-Users
I'm having the same problems. Can you tell me how you fixed this?

Naveenam K

unread,
Apr 24, 2017, 3:59:08 AM4/24/17
to RGeo-Users
I got this working by using the activerecord-mysql2spatial-adapter gem and setting my adapter in database.yml to 'mysql2spatial'
Reply all
Reply to author
Forward
0 new messages