gpt4 book ai didi

ruby-on-rails - 我如何在 ruby​​ on rails 中修复未定义的方法 `alias_method_chain' 错误?

转载 作者:行者123 更新时间:2023-12-03 22:09:28 24 4
gpt4 key购买 nike

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

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



无论是在迁移数据库还是运行服务器时。我正在使用 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应该做的伎俩。

编辑:

这就是我在喝咖啡之前上网所得到的。负责的 gem 位于您的堆栈跟踪中:activerecord-postgres-hstore ,它不在您链接到的项目中,这表明您进行了其他更改。 Rails 4+ 不需要那个 gem。 More info here

关于ruby-on-rails - 我如何在 ruby​​ on rails 中修复未定义的方法 `alias_method_chain' 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55442564/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com