NameError: uninitialized constant ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::TableDefinition
Asked Answered
L

3

6

Generated rails 4.2.0 app and added activerecord-postgis-adapter and edited the database.yml file accordingly.

But now when I do rake db:create, it blows with the 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)
Lynching answered 28/12, 2014 at 13:6 Comment(0)
E
6

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

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

Ecchymosis answered 28/12, 2014 at 13:13 Comment(1)
Latest update from the link above is that there is a beta available for activerecord-postgis-adapter which fixes this: gem "activerecord-postgis-adapter", "3.0.0.beta1"Acariasis
R
1

Version 3.0.0 of activerecord-postgis-adapter has 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

Ramsdell answered 29/5, 2015 at 23:45 Comment(0)
M
0

As pointed out by ob1 in the comment of the accepted answer, at the time of this post, the postgis adapter has a beta version which supports ActiveRecord 4.2. This is the text from the 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 extremely cumbersome to support prior versions in a single code base. Therefore, instead of having conditional support for prior versions of ActiveRecord, this adapter will only support ActiveRecord 4.2 and later in the master branch and version 3.0.

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.

Magnien answered 28/12, 2014 at 13:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.