Activerecord_Postgis_Adapter: Undefined Method 'Point' for Nil:Nilclass

activerecord_postgis_adapter: undefined method `point' for nil:NilClass

I created a github issue with a less consise but more detailed explaination.

RGeos depends on GEOS. This error is a result of RGeos not being able to load GEOS.

To check if this is the issue:

$ rails c
> RGeo::Geos.supported?
=> false

To check if you have GEOS installed:

geos-config --version

If GEOS isn't installed:

brew install geos

If GEOS is installed, fix your installed RGeo:

$ geos-config --prefix
/usr/local/Cellar/geos/3.5.0
$ gem install rgeo -- --with-geos-dir=/usr/local/Cellar/geos/3.5.0

Should now be installed correctly and your errors fixed. You can check as we did above:

$ rails c
> RGeo::Geos.supported?
=> true

If this doesn't work uninstall ALL versions of geos and rgeo:

$ brew uninstall geos
$ gem uninstall rgeo

Re-install geos and rgeo as instructed above. You should have gem 'rgeo' in your Gemfile and after you bundle, you should see this as one of the outputs: "Installing rgeo 0.4.0 with native extensions"

NoMethodError using activerecord_postgis_adapter

As of version 3.0.0 you can't set column specific geo factory properties.
And the method set_rgeo_factory_for_column is removed and deprecated.
You can, however configure RGeo factory application wide. For example in your initializer.

RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config|
# By default, use the GEOS implementation for spatial columns.
config.default = RGeo::Geos.factory_generator

# But use a geographic implementation for point columns.
config.register(RGeo::Geographic.spherical_factory(srid: 4326), geo_type: "point")
end

NoMethodError: undefined method `type' for character varying:String after rake db:migrate

Assuming you are using the gem activerecord-postgis-adapter, you'd better try to change the database adapter to postgis as recommended in their official document:

https://github.com/rgeo/activerecord-postgis-adapter

Ruby on Rails with Postgis

you could use the postgis gem. It is based on Rgeo, which provides some nice spatial methods.

Otherwise just do:

 t.column :koordinaten, :multipolygon

note: your column names should not begin with a capital letter, according to rails conventions.

ApplicationController error in rails when trying to visit web page -- wrong argument type Class (module expected)

Please check that your helpers in app/helpers folder are all modules not classes, example:

app/helpers/application_helper.rb should be:

module ApplicationHelper
end

not

class ApplicationHelper
end

Also if you're including something in your classes Concern for example it should be defined as a module not class



Related Topics



Leave a reply



Submit