簡體   English   中英

ActiveRecord::ConnectionAdapters::Table:Class (NoMethodError) 的未定義方法“alias_method_chain”。 你的意思? 別名方法

[英]undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::Table:Class (NoMethodError). Did you mean? alias_method

創建遷移時出現此錯誤。 我使用 MySQL 作為數據庫,軌道 6.0.3.2 和 ruby 2.6.6

完整的錯誤是

Traceback (most recent call last):
        51: from bin/rails:4:in `<main>'
        50: from bin/rails:4:in `require'
        49: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/commands.rb:18:in `<top (required)>'
        48: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/command.rb:46:in `invoke'
        47: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/command/base.rb:69:in `perform'
        46: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
        45: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
        44: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
        43: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/commands/generate/generate_command.rb:21:in `perform'
        42: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
        41: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/command/actions.rb:28:in `require_environment!'
        40: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/application.rb:339:in `require_environment!'
        39: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `require'
        38: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:291:in `load_dependency'
        37: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/dependencies.rb:324:in `block in require'
        36: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
        35: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/zeitwerk-2.4.0/lib/zeitwerk/kernel.rb:34:in `require'
        34: from C:/Users/Ritvik/Desktop/railsProjs/bkpk/config/environment.rb:5:in `<top (required)>'
        33: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/application.rb:363:in `initialize!'
        32: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/initializable.rb:60:in `run_initializers'
        31: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        30: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        29: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        28: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `call'
        27: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:347:in `each'
        26: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        25: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        24: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        23: from C:/Ruby26-x64/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        22: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/initializable.rb:61:in `block in run_initializers'
        21: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/initializable.rb:32:in `run'
        20: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.3.2/lib/rails/initializable.rb:32:in `instance_exec'
        19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/railtie.rb:4:in `block in <class:Railtie>'
        18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:42:in `on_load'
        17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:42:in `each'
        16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:43:in `block in on_load'
        15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
        14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
        13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
        12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
        11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/railtie.rb:5:in `block (2 levels) in <class:Railtie>'
        10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/loader.rb:3:in `load'
         9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/loader.rb:3:in `module_eval'
         8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/loader.rb:5:in `block in load'
         7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/loader.rb:5:in `include'
         6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/schema_definitions.rb:5:in `included'
         5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/schema_definitions.rb:5:in `class_eval'
         4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/schema_definitions.rb:6:in `block in included'
         3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/schema_definitions.rb:6:in `include'
         2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/concern.rb:122:in `append_features'
         1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.2/lib/active_support/concern.rb:122:in `class_eval'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/foreigner-1.7.4/lib/foreigner/connection_adapters/abstract/table.rb:7:in `block in <module:Table>': undefined method `alias_method_chain' for ActiveRecord::ConnectionAdapters::Table:Class (NoMethodError)
Did you mean?  alias_method

我在 stackoverflow 上查看過類似的錯誤,但沒有找到解決我的問題的方法。 gemfile 有gem 'mysql2', '>= 0.4.4' 我在 MySQL 0.5.3 上嘗試過,但仍然沒有運氣。

你的gemfile中有外國人gem嗎? 您可以嘗試刪除它,進行捆綁安裝並重試嗎? 根據gem的文檔,它在 rails 4.2 中已經過時,因為 rails 添加了對該功能的本機支持。

如果它不在您的 gemfile 中,您需要檢查什么 gem 依賴於它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM