Active Admin Ruby on rails Dashboard Controller Error

时间:2013-04-04 18:03:13

标签: ruby-on-rails ruby-on-rails-3 routing activeadmin

我的应用程序似乎突然发生了路由错误uninitialized constant DashboardController

我正在使用ActiveAdmin(0.6.0)运行Rails 3.2.0,直到今天一切似乎都运行正常。

日志报告在尝试运行localhost:3000时发生以下错误:

Started GET "/" for 127.0.0.1 at 2013-04-04 18:59:21 +0100

ActionController::RoutingError (uninitialized constant DashboardController):
  activesupport (3.2.0) lib/active_support/inflector/methods.rb:226:in `block in constantize'
  activesupport (3.2.0) lib/active_support/inflector/methods.rb:225:in `each'
  activesupport (3.2.0) lib/active_support/inflector/methods.rb:225:in `constantize'
  actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:62:in `controller_reference'
  actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:47:in `controller'
  actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:26:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.0) lib/action_dispatch/routing/route_set.rb:570:in `call'
  warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.1) lib/warden/manager.rb:34:in `catch'
  warden (1.2.1) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.5) lib/rack/etag.rb:23:in `call'
  rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/cookies.rb:338:in `call'
  activerecord (3.2.0) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.0) lib/active_support/callbacks.rb:405:in `_run__972453933__call__19086187__callbacks'
  activesupport (3.2.0) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.0) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.0) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.0) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.0) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.0) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.0) lib/action_dispatch/middleware/static.rb:53:in `call'
  railties (3.2.0) lib/rails/engine.rb:479:in `call'
  railties (3.2.0) lib/rails/application.rb:220:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.0) lib/rails/rack/log_tailer.rb:14:in `call'
  thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
  thin (1.5.1) lib/thin/connection.rb:79:in `catch'
  thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
  thin (1.5.1) lib/thin/connection.rb:54:in `process'
  thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
  eventmachine-1.0.3-x86 (mingw32) lib/eventmachine.rb:187:in `run_machine'
  eventmachine-1.0.3-x86 (mingw32) lib/eventmachine.rb:187:in `run'
  thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
  thin (1.5.1) lib/thin/server.rb:159:in `start'
  rack (1.4.5) lib/rack/handler/thin.rb:13:in `run'
  rack (1.4.5) lib/rack/server.rb:268:in `start'
  railties (3.2.0) lib/rails/commands/server.rb:70:in `start'
  railties (3.2.0) lib/rails/commands.rb:55:in `block in <top (required)>'
  railties (3.2.0) lib/rails/commands.rb:50:in `tap'
  railties (3.2.0) lib/rails/commands.rb:50:in `<top (required)>'
  script/rails:6:in `require'
  script/rails:6:in `<main>'


  Rendered C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (234.0ms)

还有其他人有此错误吗?我们非常感谢人们提供的任何帮助!

2 个答案:

答案 0 :(得分:75)

移动root:to =&gt; yourController #index在ActiveAdmin.routes(self)上方

当您运行bundle exec rake routes时,您将在仪表板#index上看到您的控制器#index。

出现这个问题是因为它有2条到root的路由(1个来自你,1个来自Active Admin)

答案 1 :(得分:1)