生成rails 4.2.0应用程序,并添加了activerecord适配器,并相应地编辑了database.yml文件。
但是现在,当我执行rake db:create时,它会出现错误:
± 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)发布于 2014-12-28 13:13:30
显然,activerecord-postgis-adapter宝石是not yet compatible with ActiveRecord 4.2。
要么使用标准的pg gem (这是ActiveRecord本地支持的),要么降级到4.1。
发布于 2015-05-29 23:45:48
activerecord-postgis-adapter的3.0.0版本已经发布。它支持ActiveRecord 4.2。
gem "activerecord-postgis-adapter"
发布于 2015-05-08 15:25:25
正如ob1在被接受的答案的注释中所指出的那样,在本文发布时,postgis适配器有一个支持ActiveRecord 4.2的beta版本。这是Simone Carletti提供的链接的文本:
此分支发布为3.0.0.beta 1。试验用: gem“ActiveRecord -postgis-适配器”、“3.0.0.beta 1”在PostgreSQL 4.2中对ActiveRecord适配器进行了重大更改,在单个代码库中支持以前的版本非常麻烦。因此,这个适配器将只支持主分支和版本3.0中的ActiveRecord 4.2和更高版本,而不是对以前版本的ActiveRecord提供条件支持。 ActiveRecord适配器版本2.x将继续支持ActiveRecord 4.0和4.1。 ActiveRecord适配器版本3.x将支持ActiveRecord 4.2及更高版本。
https://stackoverflow.com/questions/27676646
复制相似问题