Rails 6升级中未初始化的常量ActiveRecord :: ConnectionAdapters :: ConnectionManagement(NameError)

时间:2019-09-10 08:40:02

标签: ruby-on-rails ruby

我目前正在将Rails项目从v5.2.3升级到v6.0。我正在按照此guide升级滑轨。但是我只停留在第一步。 一旦我在gemfile中更改了rails版本并更新了rails,就无法正常工作。运行rails server会给我这个错误uninitialized constant ActiveRecord::ConnectionAdapters::ConnectionManagement (NameError)

下面是完整的堆栈跟踪:

53: from bin/rails:4:in `<main>'
52: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
51: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
50: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
49: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
48: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
47: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
46: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
45: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
44: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
43: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
42: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
41: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `perform'
40: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:138:in `tap'
39: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:147:in `block in perform'
38: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:37:in `start'
37: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/commands/server/server_command.rb:77:in `log_to_stdout'
36: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:354:in `wrapped_app'
35: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:219:in `app'
34: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/server.rb:319:in `build_app_and_options_from_config'
33: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:40:in `parse_file'
32: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `new_from_string'
31: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:49:in `eval'
30: from config.ru:in `<main>'
29: from config.ru:in `new'
28: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `initialize'
27: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/rack-2.0.7/lib/rack/builder.rb:55:in `instance_eval'
26: from config.ru:3:in `block in <main>'
25: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require'
24: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
23: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
22: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
21: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
20: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
19: from /Volumes/gitdisk/PAC/codephod2/config/environment.rb:5:in `<main>'
18: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
17: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
16: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
15: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
14: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
13: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `call'
12: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:347:in `each'
11: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
10: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
 9: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
 8: from /Users/shubham/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
 7: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
 6: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
 5: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
 4: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/airbrake-5.8.1/lib/airbrake/rails/railtie.rb:26:in `block in <class:Railtie>'
 3: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `load_missing_constant'
 2: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `rescue in load_missing_constant'
 1: from /Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/Users/shubham/.rvm/gems/ruby-2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `block in load_missing_constant': uninitialized constant ActiveRecord::ConnectionAdapters::ConnectionManagement (NameError)

2 个答案:

答案 0 :(得分:3)

我有同样的问题。我修复了升级的风刹宝石

gem 'airbrake', '~> 10.0.3'

答案 1 :(得分:1)

您在代码中的某个地方调用了不赞成使用的常量:ActiveRecord::ConnectionAdapters::ConnectionManagement。从您的堆栈跟踪中,我怀疑您使用的是过时的气刹宝石。尝试将刹车片更新为最新版本。让我知道是否可以帮您解决这个问题。

您可以了解有关此here

的更多信息