NameError: uninitialized constant ActiveRecord :: ConnectionAdapters :: PostgreSQLAdapter :: TableDefinition

The generated rails 4.2.0 application and added the activerecord-postgis adapter and edited the database.yml file accordingly.

But now, when I do rake db:create , it throws an error:

 Β± be rake db:create 2.1.0 rake aborted! NameError: uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition /Users/millisami/Railsapps/showme/config/application.rb:16:in `<top (required)>' /Users/millisami/Railsapps/showme/Rakefile:4:in `require' /Users/millisami/Railsapps/showme/Rakefile:4:in `<top (required)>' (See full trace by running task with --trace) 
+6
source share
3 answers

Apparently, the activerecord-postgis-adapter stone is not yet compatible with ActiveRecord 4.2 .

Either use the standard pg gem (which is natively supported by ActiveRecord), or downgrade to 4.1.

+6
source

Version 3.0.0 activerecord-postgis-adapter been released. It supports ActiveRecord 4.2.

gem "activerecord-postgis-adapter"

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

https://rubygems.org/gems/activerecord-postgis-adapter

+1
source

As pointed out by ob1 in the comment of the accepted answer, during this postgis adapter has a beta version that supports ActiveRecord 4.2. This is the text from a link provided by Simone Carletti:

This branch is released as 3.0.0.beta1. Test with:

gem "activerecord-postgis-adapter", "3.0.0.beta1" There are significant changes to the PostgreSQL adapter in ActiveRecord 4.2 and it is very difficult to support previous versions in a single code base. Therefore, instead of conditionally supporting previous versions of ActiveRecord, this adapter only supports ActiveRecord 4.2 and later in the main branch and version 3.0.

The activerecord-postgis adapter version 2.x will continue to support ActiveRecord 4.0 and 4.1.

activerecord-postgis adapter version 3.x will support ActiveRecord 4.2 and later.

0
source

Source: https://habr.com/ru/post/980229/


All Articles