我刚刚克隆了一个github repo https://github.com/maxitron93/p2pcollective.com,因为我正在探索这个令人敬畏的p2p借阅应用程序我遇到了一个错误
NoMethodError:ActiveRecord的未定义方法`alias_method_chain':: ConnectionAdapters :: PostgreSQLColumn:Class
迁移db或运行服务器时都是如此。我正在使用cloud9 ide来避免我的电脑环境。
通过几个解决方案帖子,我用设备和erubis更新了我的gem商店,但仍然返回到'alias_method_chain'错误。
这是我的日志片段:
rake db:migrate
rake aborted!
NoMethodError: undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::PostgreSQLColumn:Class
Did you mean? alias_method
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:80:in `<class:PostgreSQLColumn>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:74:in `<module:ConnectionAdapters>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:70:in `<module:ActiveRecord>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/activerecord.rb:2:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `block in require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:256:in `block in load_dependency'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:662:in `new_constants_in'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:256:in `load_dependency'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:292:in `require'
/usr/local/rvm/gems/ruby-2.3.4/gems/activerecord-postgres-hstore-0.7.8/lib/activerecord-postgres-hstore/railties.rb:18:in `block (2 levels) in <class:Hstore>'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
/usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
我希望我的rails服务器从这里顺利运行。
alias_method_chain
在Rails 5中被弃用并删除,但在此之前就存在了。它看起来像已安装的依赖项(可能是pg
)是不兼容的。你可以用bundle update pg
解决这个问题,如果没有,更广泛的bundle update
应该可以解决问题。
编辑:
这就是我在喝咖啡之前上网的原因。负责的宝石是在你的堆栈跟踪:activerecord-postgres-hstore
,它不在你链接的项目中,这表明你已经做了其他更改。你不需要Rails 4+的宝石。 More info here