gpt4 book ai didi

ruby-on-rails - ActionDispatch::Request:Class 的未定义方法 `alias_method_chain'

转载 作者:行者123 更新时间:2023-12-05 06:34:04 25 4
gpt4 key购买 nike

NoMethodError:ActionDispatch::Request:Class 的未定义方法“alias_method_chain”

我在安装 wiselinks gem 后遇到这个问题。

Ruby 版本:Ruby 2.4.0

Rails 版本:Rails 5.1.3

rake 中止!

NoMethodError:ActionDispatch::Request:Class/home/wscube/.rvm/gems/ruby-2.4.0/gems/wiselinks-1.2.1/lib/wiselinks/request.rb:4 的未定义方法 alias_method_chain'包括'/home/wscube/.rvm/gems/ruby-2.4.0/gems/wiselinks-1.2.1/lib/wiselinks/rails.rb:9:in include'/home/wscube/.rvm/gems/ruby-2.4 .0/gems/wiselinks-1.2.1/lib/wiselinks/rails.rb:9:inblock 类:Engine'/home/wscube/.rvm/gems/ruby-2.4.0/gems/railties-5.1.3/lib/rails/initializable.rb:30:in instance_exec'/home/wscube/.rvm/gems/ruby-2.4 .0/gems/railties-5.1.3/lib/rails/initializable.rb:30:inrun'/home/wscube/.rvm/gems/ruby-2.4.0/gems/railties-5.1.3/lib/rails/initializable.rb:59:in block in run_initializers'/home/wscube/.rvm/gems/ruby -2.4.0/gems/railties-5.1.3/lib/rails/initializable.rb:58:inrun_initializers'/home/wscube/.rvm/gems/ruby-2.4.0/gems/railties-5.1.3/lib/rails/application.rb:353:in initialize!'/home/wscube/Upstge/upstge-latest-version/config/environment.rb:5:in'/home/wscube/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:in require'/home/wscube/.rvm/gems/ruby-2.4 .0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:inblock in require'/home/wscube/.rvm/gems/ruby-2.4.0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:258:in load_dependency'/home/wscube/.rvm/gems/ruby-2.4 .0/gems/activesupport-5.1.3/lib/active_support/dependencies.rb:292:inrequire'/home/wscube/.rvm/gems/ruby-2.4.0/gems/railties-5.1.3/lib/rails/application.rb:329:in require_environment!'/home/wscube/.rvm/gems/ruby-2.4.0/gems/railties-5.1.3/lib/rails/application.rb:445:inblock in run_tasks_blocks'/home/wscube/.rvm/gems/ruby-2.4.0/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:62:in block (2 levels) in define'/home/wscube/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/exe/rake:27:in'/home/wscube/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in eval'/home/wscube/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in

最佳答案

Rails 5.1 放弃了 alias_method_chain 以支持 Module#prependWiselinks自 2014 年以来一直没有更新,并且与 Rails 5 不兼容。

您的选择是有限的:

  1. 使用旧版本的 Rails 以便您可以使用 Wiselinks。
  2. 使用 Wiselinks 以外的东西。
  3. 尝试让 Wiselinks 作者更新它以适应新版本的 Rails。
  4. Fork Wiselinks 并更新它以自己使用最新的 Rails。有一个 pull request for this但它已经闲置了将近一个月。

我会倾向于 (2) 除非你想 fork 它并负责维护 fork 。在 Rails 世界中四年未更新的东西可能已经被放弃了。

关于ruby-on-rails - ActionDispatch::Request:Class 的未定义方法 `alias_method_chain',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50443382/

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