ruby-on-rails 升级后未初始化的常量Devise::SessionsController

eblbsuwk  于 2023-04-08  发布在  Ruby
关注(0)|答案(1)|浏览(260)

我有一个基于ruby 2.7.1, devise 4.7.2activeadmin 2.9.0构建的rails 5.2应用程序。我想将其更新为当前版本。当我将ruby更新为3.2.1、将rails更新为7.0、将devise更新为4.9.2、将activeadmin更新为2.13时,我得到了
uninitialized constant Devise::SessionsController in gem lib file .rvm/gems/ruby-3.2.1/gems/activeadmin-2.13.1/lib/active_admin/devise.rb:54:in <module:Devise>':

uninitialized constant Devise::SessionsController (NameError)
from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/activeadmin-2.13.1/lib/active_admin/devise.rb:7:in `<module:ActiveAdmin>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/activeadmin-2.13.1/lib/active_admin/devise.rb:6:in `<main>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/zeitwerk-2.6.4/lib/zeitwerk/kernel.rb:38:in `require'
    from /home/ahmad/Project/cuddleClone/oms-version-update/config/initializers/active_admin.rb:350:in `<main>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/engine.rb:667:in `load'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/engine.rb:667:in `block in load_config_initializer'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/activesupport-7.0.4.3/lib/active_support/notifications.rb:208:in `instrument'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/engine.rb:666:in `load_config_initializer'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/engine.rb:619:in `each'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/engine.rb:619:in `block in <class:Engine>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/initializable.rb:32:in `instance_exec'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/initializable.rb:32:in `run'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:228:in `block in tsort_each'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/initializable.rb:50:in `each'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/initializable.rb:50:in `tsort_each_child'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:415:in `call'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:415:in `each_strongly_connected_component_from'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:347:in `each'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:347:in `call'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:347:in `each_strongly_connected_component'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:226:in `tsort_each'
    from /home/ahmad/.rvm/rubies/ruby-3.2.1/lib/ruby/3.2.0/tsort.rb:205:in `tsort_each'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/initializable.rb:60:in `run_initializers'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/application.rb:372:in `initialize!'
    from /home/ahmad/Project/cuddleClone/oms-version-update/config/environment.rb:5:in `<main>'
    from config.ru:3:in `require_relative'
    from config.ru:3:in `block in <main>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/rack-2.2.6.4/lib/rack/builder.rb:116:in `eval'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/rack-2.2.6.4/lib/rack/builder.rb:116:in `new_from_string'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/rack-2.2.6.4/lib/rack/builder.rb:105:in `load_file'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/rack-2.2.6.4/lib/rack/builder.rb:66:in `parse_file'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/rack-2.2.6.4/lib/rack/server.rb:349:in `build_app_and_options_from_config'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/rack-2.2.6.4/lib/rack/server.rb:249:in `app'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/rack-2.2.6.4/lib/rack/server.rb:422:in `wrapped_app'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/commands/server/server_command.rb:36:in `start'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/commands/server/server_command.rb:143:in `block in perform'
    from <internal:kernel>:90:in `tap'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/commands/server/server_command.rb:134:in `perform'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/command/base.rb:87:in `perform'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/command.rb:48:in `invoke'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/railties-7.0.4.3/lib/rails/commands.rb:18:in `<main>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/bootsnap-1.16.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
    from /home/ahmad/Project/cuddleClone/oms-version-update/bin/rails:9:in `<top (required)>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
    from /home/ahmad/.rvm/gems/ruby-3.2.1/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
    from /home/ahmad/Project/cuddleClone/oms-version-update/bin/spring:15:in `require'
    from /home/ahmad/Project/cuddleClone/oms-version-update/bin/spring:15:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

有简单的解决方法吗?

f4t66c6m

f4t66c6m1#

这是命名错误。Active Admin正在搜索找不到的会话**% s**控制器(额外% s)。您应该检查会话的设备控制器的命名。
也许你有SessionController而不是SessionsController

相关问题