我如何在未定义的方法`alias_method_chain'错误中修复ruby? [英] How do i fix in ruby on rails the undefined method `alias_method_chain' error?

查看:284
本文介绍了我如何在未定义的方法`alias_method_chain'错误中修复ruby?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚克隆了一个github存储库 https://github.com/maxitron93/p2pcollective.com ,因为我在探索这个很棒的p2p借贷应用程序时遇到错误

I have just cloned a github repo https://github.com/maxitron93/p2pcollective.com, as i was exploring this awesome p2p lending app i encountered an error

NoMethodError:ActiveRecord :: ConnectionAdapters :: PostgreSQLColumn:Class的未定义方法"alias_method_chain"

NoMethodError: undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::PostgreSQLColumn:Class

同时迁移数据库或运行服务器.我正在使用cloud9 ide来避免我的PC环境.

both when migrationg db or raunning server. I'm using the cloud9 ide to avoid my pc environment.

在解决方案中,我用设备和erubis更新了我的gem商店,但仍然返回到"alias_method_chain"错误.

Running through a couple of solution posts, i updated my gem store with device and erubis but still returned back to that 'alias_method_chain' error.

这是我的日志的一部分:

Here's a snippet of my logs:

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服务器从这里平稳运行.

I expect my rails server to run smoothly from here.

推荐答案

alias_method_chain在Rails 5中已弃用并删除,但在此之前存在.似乎已安装的依赖项(可能是pg)不兼容.您可以使用bundle update pg解决此问题,否则,可以使用更广泛的bundle update解决问题.

alias_method_chain was deprecated and removed in Rails 5, but existed prior to that. It looks like a dependency (possibly pg) that has been installed is incompatible. You may be able to resolve the issue with bundle update pg, and if not, a broader bundle update should do the trick.

这就是我喝咖啡之前上网的东西.负责的gem在您的堆栈跟踪中:activerecord-postgres-hstore,该链接不在您链接的项目中,这表明您进行了其他更改.对于Rails 4+,您不需要该宝石. 此处更多信息

This is what I get for internet'ing before coffee. The gem responsible is in your stacktrace: activerecord-postgres-hstore, which isn't in the project you linked to, which suggests you've made other changes. You don't need that gem for Rails 4+. More info here

这篇关于我如何在未定义的方法`alias_method_chain'错误中修复ruby?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆