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.ymldevelopment:
<<: *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!