我遇到了最奇怪的错误。有时(通常在代码推送之后),我将SSH连接到我们的生产RoR服务器并加载控制台。当发生这种情况时,我得到一个疯狂的NameError
错误,然后我再次尝试并且控制台加载,但我不能使用我的任何类
ubuntu@ip-10-0-1-10 /v/w/numanage> rails c -e production
/home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:268:in `const_get': uninitialized constant AdminUser
Did you mean? Admin (NameError)
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:268:in `block in constantize'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:266:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:266:in `inject'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/inflector/methods.rb:266:in `constantize'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:583:in `get'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:614:in `constantize'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise.rb:301:in `get'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise/mapping.rb:81:in `to'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise/mapping.rb:76:in `modules'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise/mapping.rb:93:in `routes'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise/mapping.rb:160:in `default_used_route'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise/mapping.rb:70:in `initialize'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise.rb:331:in `new'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise.rb:331:in `add_mapping'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise/rails/routes.rb:241:in `block in devise_for'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise/rails/routes.rb:240:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/devise-4.2.0/lib/devise/rails/routes.rb:240:in `devise_for'
from /var/www/numanage/config/routes.rb:12:in `block in <top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:389:in `instance_exec'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:389:in `eval_block'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/actionpack-5.0.0.1/lib/action_dispatch/routing/route_set.rb:371:in `draw'
from /var/www/numanage/config/routes.rb:1:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `load'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:16:in `reload!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/file_update_checker.rb:77:in `execute'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/application/routes_reloader.rb:7:in `execute'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:132:in `block (2 levels) in <module:Finisher>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:396:in `instance_exec'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:396:in `block in make_lambda'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:169:in `block (2 levels) in halting'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:547:in `block (2 levels) in default_terminator'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:546:in `catch'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:546:in `block in default_terminator'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:170:in `block in halting'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `block in call'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `each'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:454:in `call'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:101:in `__run_callbacks__'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:750:in `_run_run_callbacks'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/callbacks.rb:90:in `run_callbacks'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/execution_wrapper.rb:99:in `run!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:113:in `run!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:48:in `block (2 levels) in reload!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:46:in `tap'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:46:in `block in reload!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/execution_wrapper.rb:76:in `wrap'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/reloader.rb:45:in `reload!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:154:in `serve'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
ubuntu@ip-10-0-1-10 /v/w/numanage> rails c -e production
Running via Spring preloader in process 4926
Loading production environment (Rails 5.0.0.1)
2.3.1 :001 > User
NameError: uninitialized constant User
from (irb):2
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/commands/console.rb:65:in `start'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/commands/console_helper.rb:9:in `start'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:78:in `console'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
from /var/www/numanage/bin/rails:9:in `<top (required)>'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `load'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/commands/rails.rb:6:in `call'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/command_wrapper.rb:38:in `call'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:191:in `block in serve'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:161:in `fork'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:161:in `serve'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:131:in `block in run'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:125:in `loop'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application.rb:125:in `run'
from /home/ubuntu/.rvm/gems/ruby-2.3.1@numanage/gems/spring-1.7.2/lib/spring/application/boot.rb:19:in `<top (required)>'
from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
2.3.1 :003 >
真正疯狂的部分是,美洲狮服务器启动就好了,行为就像没有错误
我真的迷失了甚至调试这个,让我知道你是否有任何想法
编辑: 我们使用的是devise和ActiveAdmin gems,所以routes.rb:12如下
devise_for :admin_users, ActiveAdmin::Devise.config
看起来设计正在加载AdminUser(ActiveRecord模型),由于某种未知原因而失败