未初始化的常量 ApplicationController (NameError) - 应用程序在本地工作正常 [英] uninitialized constant ApplicationController (NameError) - application works fine locally
本文介绍了未初始化的常量 ApplicationController (NameError) - 应用程序在本地工作正常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在 rackspace 云服务器上在线设置了一个简单的应用程序,但我收到来自 phusion 乘客的以下错误消息:
I've set up a simple application online on a rackspace cloud server but I'm getting the following error message from phusion passenger:
uninitialized constant ApplicationController (NameError)
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:230:in `block in constantize'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:229:in `each'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/inflector/methods.rb:229:in `constantize'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.12/lib/active_support/core_ext/string/inflections.rb:54:in `constantize'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/devise-2.2.4/app/controllers/devise_controller.rb:2:in `<top (required)>'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/devise-2.2.4/app/controllers/devise/confirmations_controller.rb:1:in `<top (required)>'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/engine.rb:438:in `each'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/engine.rb:438:in `block in eager_load!'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/engine.rb:436:in `each'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/engine.rb:436:in `eager_load!'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/railties.rb:8:in `each'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/railties.rb:8:in `all'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/engine.rb:434:in `eager_load!'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `instance_exec'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:30:in `run'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:55:in `block in run_initializers'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `each'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/initializable.rb:54:in `run_initializers'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/application.rb:136:in `initialize!'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/ideamobb.com/config/environment.rb:5:in `<top (required)>'
config.ru:3:in `require'
config.ru:3:in `block in <main>'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.8/helper-scripts/rack-preloader.rb:82:in `eval'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.8/helper-scripts/rack-preloader.rb:82:in `preload_app'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.8/helper-scripts/rack-preloader.rb:127:in `<module:App>'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.8/helper-scripts/rack-preloader.rb:6:in `<module:PhusionPassenger>'
/var/www/.rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.8/helper-scripts/rack-preloader.rb:5:in `<main>'
我不确定这里发生了什么 - 该应用程序在我的本地主机上运行良好 - 所有 gem 都已安装,迁移已清除 - 那么这里究竟可能是什么问题?
I'm not sure whats going on here - the application works perfectly fine on my localhost - all the gems are installed, migrations are cleared - so what exactly might be the problem here?
推荐答案
我认为您缺少 ApplicationController.所有其他控制器都继承自该类
I think you are missing ApplicationController. All other controllers inherit from this class
一个简单的application_controller.rb
class ApplicationController < ActionController::Base
end
这篇关于未初始化的常量 ApplicationController (NameError) - 应用程序在本地工作正常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文