0

我在http://bob.dev/assessments/new的“新”路径上收到一个动作控制器异常。我最近在项目中添加了设计和六分仪,而给我带来问题的路径以前是有效的。

例外:

uninitialized constant ErrorsController (ActionController::RoutingError)

路线:

Bob::Application.routes.draw do
  devise_for :users

  mount_sextant                                   # Sextant gem #####################
  match '*not_found' => 'errors#handle404'        # visit http://bob.dev/rails/routes
  match "*path" => 'errors#handle404'             ###################################

  # resources :users                              # Authentication from scratch #####
  # resources :sessions                           ###################################

  root :to => "assessments#index"
    resources :assessments
end

最后,来自http://bob.dev/rails/routes通过六分仪的输出:

        new_user_session GET    /users/sign_in(.:format)          devise/sessions#new
            user_session POST   /users/sign_in(.:format)          devise/sessions#create
    destroy_user_session DELETE /users/sign_out(.:format)         devise/sessions#destroy
           user_password POST   /users/password(.:format)         devise/passwords#create
       new_user_password GET    /users/password/new(.:format)     devise/passwords#new
      edit_user_password GET    /users/password/edit(.:format)    devise/passwords#edit
                         PUT    /users/password(.:format)         devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)           devise/registrations#cancel
       user_registration POST   /users(.:format)                  devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)          devise/registrations#new
  edit_user_registration GET    /users/edit(.:format)             devise/registrations#edit
                         PUT    /users(.:format)                  devise/registrations#update
                         DELETE /users(.:format)                  devise/registrations#destroy
       user_confirmation POST   /users/confirmation(.:format)     devise/confirmations#create
   new_user_confirmation GET    /users/confirmation/new(.:format) devise/confirmations#new
                         GET    /users/confirmation(.:format)     devise/confirmations#show
            rails_routes GET    /rails/routes(.:format)           rails/routes#index
             rails_route GET    /rails/routes/:id(.:format)       rails/routes#show
                                /*not_found(.:format)             errors#handle404
                                /*path(.:format)                  errors#handle404
                    root        /                                 assessments#index
             assessments GET    /assessments(.:format)            assessments#index
                         POST   /assessments(.:format)            assessments#create
          new_assessment GET    /assessments/new(.:format)        assessments#new
         edit_assessment GET    /assessments/:id/edit(.:format)   assessments#edit
              assessment GET    /assessments/:id(.:format)        assessments#show
                         PUT    /assessments/:id(.:format)        assessments#update
                         DELETE /assessments/:id(.:format)        assessments#destroy
                         GET    /rails/routes(.:format)           rails/routes#index
                         GET    /rails/routes/:id(.:format)       rails/routes#show
4

2 回答 2

1

您可以安全地删除线路

  match '*not_found' => 'errors#handle404'        
  match "*path" => 'errors#handle404'             

他们不需要。这将解决您的错误。虽然如果您想为您的应用程序创建自定义错误处理程序,请查看 Jose 的帖子中的第 3条 http://blog.plataformatec.com.br/2012/01/my-five-favorite-hidden-features-in-rails- 3-2/

于 2012-06-28T04:05:01.507 回答
0

我猜想“错误”一词是保留的,并且在新的依赖项之一中存在冲突。您可以将这些路线/控制器称为不同的东西吗?

于 2012-06-26T19:58:06.270 回答