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
Ruby: Cannot Install Watir Gem on Windows
Nested Form_For Singular Resource
Scoping Date Attribute for This Week
Webmock Simulate Failing API (No Internet, Timeout ++)
Exclude Option from Collection.Map in Ruby on Rails
Ruby - Compare Two Enumerators Elegantly
Detect When a Devise Session Expires
Rails User Profile Page Only Accessible to Correct User
Ruby on Rails Active Admin Has_Many Changing Dropdown to Use a Different Column
Ruby on Rails - $ Rails Server Fails Because Uglifier Gem Could Not Be Found
Insert Rows on Specific Line in a File
+= Operator Appears to Modify Frozen String
How to Convert a Ruby Bigdecimal to a 2-Decimal Place String
Ruby Strftime '%Z' Method Returns '0545' Instead of 'Npt'
What Does a Single Splat/Asterisk in a Ruby Argument List Mean