未初始化常量 Devise::SessionsController

问题描述 投票:0回答:1

我有基于 ruby 2.7.1、rails 5.2、devise 4.7.2 和 activeadmin 2.9.0 构建的 rails 应用程序。我想将它更新到当前版本。当我将 ruby 更新到 3.2.1、rails 到 7.0、devise 到 4.9.2 和 activeadmin 到 2.13 时,我在 gem lib 文件 .rvm/gems/ruby-3.2.1/ 中得到了未初始化的常量 Devise::SessionsController gems/activeadmin-2.13.1/lib/active_admin/devise.rb:54:in module:Devise': 未初始化常量 Devise::SessionsController (NameError)

来自/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 
' 来自/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' 来自/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 
' 来自/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' 来自/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' 来自/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' 来自/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' 来自 /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' 来自/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' 来自/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' 来自/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' 来自/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' 来自/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' 来自/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' 来自/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' 来自/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' 来自/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 
' 来自 config.ru:3:in
require_relative' from config.ru:3:in 
block in ' 来自/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' 来自/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' 来自 /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' 来自/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' 来自/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' 来自内部:内核:90:在
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 
执行' 来自/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' 来自/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' 来自/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 
' 来自/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' 来自 /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' 来自/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' 来自/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 
' 来自/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 
' 来自 /home/ahmad/Project/cuddleClone/oms-version-update/bin/spring:15:in
require' from /home/ahmad/Project/cuddleClone/oms-version-update/bin/spring:15:in 
' 来自 bin/rails:3:in
load' from bin/rails:3:in 
'

它需要正常工作。

ruby-on-rails ruby devise activeadmin uninitialized-constant
1个回答
0
投票

这是一个命名错误。 Active Admin 正在搜索它找不到的 SessionsController (extra s)。您应该检查会话的 Devise 控制器的命名。

也许你有

SessionController
而不是
SessionsController

© www.soinside.com 2019 - 2024. All rights reserved.