在从Ruby 2.6.6升级到Ruby 3.1.3和从Rails 5.2.6升级到Rails 6.0.6时,我确保遵循并合并了这两个Rails版本之间的所有更改。
mw@2981eebea820:/workspaces/mw$ bundle exec rspec spec
DEPRECATION WARNING: Logger don't need to call #after_initialize directly anymore. It will be deprecated without replacement in Rails 6.1. (called from new at /workspaces/mw/config/application.rb:53)
An error occurred while loading ./spec/controllers/basic_controller_spec.rb.
Failure/Error: require 'rspec/rails'
NameError:
uninitialized constant ActiveRecord::Railtie::ActiveRecord
include ActiveRecord::Railties::ControllerRuntime
^^^^^^^^^^^^
# /usr/local/bundle/gems/activerecord-6.0.6/lib/active_record/railtie.rb:209:in `block (2 levels) in <class:Railtie>'
# /usr/local/bundle/gems/activesupport-6.0.6/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
# /usr/local/bundle/gems/activesupport-6.0.6/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
# /usr/local/bundle/gems/activesupport-6.0.6/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
# /usr/local/bundle/gems/activesupport-6.0.6/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
# /usr/local/bundle/gems/activesupport-6.0.6/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
# /usr/local/bundle/gems/activesupport-6.0.6/lib/active_support/lazy_load_hooks.rb:51:in `each'
# /usr/local/bundle/gems/activesupport-6.0.6/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
# /usr/local/bundle/gems/actionpack-6.0.6/lib/action_controller/base.rb:269:in `<class:Base>'
# /usr/local/bundle/gems/actionpack-6.0.6/lib/action_controller/base.rb:166:in `<module:ActionController>'
# /usr/local/bundle/gems/actionpack-6.0.6/lib/action_controller/base.rb:7:in `<main>'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
# /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /usr/local/bundle/gems/actionview-6.0.6/lib/action_view/test_case.rb:13:in `<class:TestCase>'
# /usr/local/bundle/gems/actionview-6.0.6/lib/action_view/test_case.rb:12:in `<module:ActionView>'
# /usr/local/bundle/gems/actionview-6.0.6/lib/action_view/test_case.rb:10:in `<main>'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
# /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
# /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
# /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
# /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# ./spec/spec_helper.rb:5:in `<main>'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/bootsnap-1.15.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
# /usr/local/bundle/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
# /usr/local/bundle/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:38:in `require'
# ./spec/rails_helper.rb:10:in `<top (required)>'
# ./spec/controllers/basic_controller_spec.rb:1:in `require'
# ./spec/controllers/basic_controller_spec.rb:1:in `<top (required)>'
1条答案
按热度按时间szqfcxe21#
你在Ruby之间做了巨大的跳跃吗?你应该先移到2.7,然后当它工作正常时,你就移到3.0等等。这是我在一个巨大的跳跃中断后所做的,我甚至不知道问题是从哪里来的。我回滚并做了一些小的跳跃,一切都解决了。我知道这不是一个代码解决方案,但我希望它无论如何都能有所帮助。