undefined метод `alias_method_chain 'для ActiveRecord :: ConnectionAdapters :: Table: Class (NoMethodError). Вы имели в виду? alias_method - PullRequest
0 голосов
/ 01 августа 2020

Я получаю эту ошибку при создании миграции. Я использую 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, но не нашел решения своей проблемы. В гемфайле gem 'mysql2', '>= 0.4.4'. Я пробовал на MySQL 0.5.3, но все равно не повезло.

1 Ответ

0 голосов
/ 01 августа 2020

У вас есть драгоценный камень иностранца в вашем gemfile? Вы можете попробовать удалить его, выполнить установку пакета и повторить попытку? Согласно документации на gem он стал устаревшим с rails 4.2, поскольку rails добавили встроенную поддержку этой функции.

Если его нет в вашем gemfile, вам нужно проверить, от какого gemfile зависит на нем.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...