ActionDispatch :: Request的未定义方法`alias_method_chain':类

时间:2018-05-21 06:46:13

标签: ruby-on-rails ruby wiselinks

NoMethodError:ActionDispatch :: Request:Class

的未定义方法`alias_method_chain'

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

Ruby版本:Ruby 2.4.0

Rails版本:Rails 5.1.3

rake aborted!

NoMethodError:ActionDispatch :: Request的未定义方法alias_method_chain':Class /home/wscube/.rvm/gems/ruby-2.4.0/gems/wiselinks-1.2.1/lib/wiselinks/request.rb:4: inincluded” /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 in class: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.0 /宝石/ railties-5.1.3 / LIB /轨道/ 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 /宝石/ railties-5.1.3 / LIB /轨道/ 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.0 /宝石/的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在定义'/ home /中的块(2级) wscube/.rvm/gems/ruby-2.4.0@global/gems/rake-12.0.0/exe/rake:27:在 /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

1 个答案:

答案 0 :(得分:0)

Rails 5.1放弃了alias_method_chain,转而使用Module#prepend; Wiselinks自2014年以来未经更新,与Rails 5不兼容。

您的选择有限:

  1. 使用较旧版本的Rails,以便您可以使用Wiselinks。
  2. 使用Wiselinks以外的其他内容。
  3. 尝试让Wiselinks作者为更新版本的Rails更新它。
  4. Fork Wiselinks并将其更新为自己使用最新的Rails。有一个pull request for this,但它已经闲置了将近一个月。
  5. 我倾向于(2),除非你想分叉并负责维护前叉。在Rails世界中四年没有更新的东西可能已被放弃。