activerecord_postgis_adapter: undefined method `point' for nil:NilClass

后端 未结 1 1746
闹比i
闹比i 2021-01-06 11:41

Problem

90% sure it\'s a setup error on my end, but I can\'t do self.factory and trying to access lonlat gives me an exception \"undefined method `point\' for nil:

1条回答
  •  清酒与你
    2021-01-06 12:04

    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"

    0 讨论(0)
提交回复
热议问题