6
votes

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)
3

3 Answers

6
votes

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.

1
votes

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

0
votes

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.