devise routing error

2019-04-11 08:31发布

问题:

I can't seem to get past this error when setting up devise.

Routing Error

wrong constant name Devise/registrationsController

or

Routing Error

wrong constant name Devise/sessionsController

I'm using Ruby 1.8.7, Rails 3.0 and Devise 1.1.3

Everything else on my app works, I recently upgraded my app from 2.3.8 and was previously using authlogic but didn't have any users other than myself so I just jettisoned my User, Session models and User, UserSession controllers... so I'm figuring that has something do to with it because I made a new Rails 3 app to test devise on my configuration and the routing working perfectly.

Any ideas?

In addition to:

devise_for :users

I also tried:

devise_scope :user do
  get "register"  => "devise/registrations#new" 
  get "login"  => "devise/sessions#new"    
  get "logout" => "devise/sessions#destroy"
end 

Here's my complete trace

Started GET "/users/sign_in" for 127.0.0.1 at Fri Oct 01 12:11:59 +0200 2010

ActionController::RoutingError (wrong constant name Devise/sessionsController):
  activesupport (3.0.0) lib/active_support/inflector/methods.rb:113:in `const_defined?'
  activesupport (3.0.0) lib/active_support/inflector/methods.rb:113:in `constantize'
  activesupport (3.0.0) lib/active_support/inflector/methods.rb:112:in `each'
  activesupport (3.0.0) lib/active_support/inflector/methods.rb:112:in `constantize'
  activesupport (3.0.0) lib/active_support/dependencies.rb:523
  activesupport (3.0.0) lib/active_support/dependencies.rb:533:in `call'
  activesupport (3.0.0) lib/active_support/dependencies.rb:533:in `default'
  activesupport (3.0.0) lib/active_support/dependencies.rb:533:in `[]'
  activesupport (3.0.0) lib/active_support/dependencies.rb:533:in `get'
  actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:58:in `controller_reference'
  actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:44:in `controller'
  actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:23:in `call'
  actionpack (3.0.0) lib/action_dispatch/routing/mapper.rb:34:in `call'
  rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `call'
  rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `recognize'
  rack-mount (0.6.13) lib/rack/mount/code_generation.rb:68:in `optimized_each'
  rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
  rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
  actionpack (3.0.0) lib/action_dispatch/routing/route_set.rb:492:in `call'
  warden (0.10.7) lib/warden/manager.rb:35:in `call'
  warden (0.10.7) lib/warden/manager.rb:34:in `catch'
  warden (0.10.7) lib/warden/manager.rb:34:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/head.rb:14:in `call'
  rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/flash.rb:182:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/cookies.rb:287:in `call'
  activerecord (3.0.0) lib/active_record/query_cache.rb:32:in `call'
  activerecord (3.0.0) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
  activerecord (3.0.0) lib/active_record/query_cache.rb:12:in `cache'
  activerecord (3.0.0) lib/active_record/query_cache.rb:31:in `call'
  activerecord (3.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:46:in `call'
  activesupport (3.0.0) lib/active_support/callbacks.rb:415:in `_run_call_callbacks'
  actionpack (3.0.0) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
  rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/show_exceptions.rb:46:in `call'
  railties (3.0.0) lib/rails/rack/logger.rb:13:in `call'
  rack (1.2.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.0.0) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.2.1) lib/rack/lock.rb:11:in `call'
  rack (1.2.1) lib/rack/lock.rb:11:in `synchronize'
  rack (1.2.1) lib/rack/lock.rb:11:in `call'
  actionpack (3.0.0) lib/action_dispatch/middleware/static.rb:30:in `call'
  railties (3.0.0) lib/rails/application.rb:168:in `call'
  railties (3.0.0) lib/rails/application.rb:77:in `send'
  railties (3.0.0) lib/rails/application.rb:77:in `method_missing'
  railties (3.0.0) lib/rails/rack/log_tailer.rb:14:in `call'
  rack (1.2.1) lib/rack/content_length.rb:13:in `call'
  rack (1.2.1) lib/rack/chunked.rb:15:in `call'
  thin (1.2.7) lib/thin/connection.rb:76:in `pre_process'
  thin (1.2.7) lib/thin/connection.rb:74:in `catch'
  thin (1.2.7) lib/thin/connection.rb:74:in `pre_process'
  thin (1.2.7) lib/thin/connection.rb:57:in `process'
  thin (1.2.7) lib/thin/connection.rb:42:in `receive_data'
  eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
  eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
  thin (1.2.7) lib/thin/backends/base.rb:57:in `start'
  thin (1.2.7) lib/thin/server.rb:156:in `start'
  rack (1.2.1) lib/rack/handler/thin.rb:14:in `run'
  rack (1.2.1) lib/rack/server.rb:213:in `start'
  railties (3.0.0) lib/rails/commands/server.rb:65:in `start'
  railties (3.0.0) lib/rails/commands.rb:30
  railties (3.0.0) lib/rails/commands.rb:27:in `tap'
  railties (3.0.0) lib/rails/commands.rb:27
  script/rails:6:in `require'
  script/rails:6

Complete routes.rb

Travelapp::Application.routes.draw do

  devise_for :users

  match 'inquiry/:id' => 'inquires#new', :as => :inquiry
  match 'docs/:permalink' => 'docs#show', :as => :docs
  match 'contact' => 'feedbacks#new', :as => :contact
  #match 'register/:id' => 'properties#new', :as => :register

  resources :manage do
    resources :rooms
    resources :room_rates
    resources :availables
    resources :manage_bookings
  end

  resources :feedbacks
  resources :invitations
  resources :flights

  match 'about' => 'pages#about', :as => :about
  match 'contact' => 'pages#contact', :as => :contact
  match 'features' => 'pages#features', :as => :features
  match 'comparison' => 'pages#comparison', :as => :comparison

  resources :badges do
    collection do
      post :sort
    end
  end

  resources :announcements do
    collection do
      post :dismiss
    end
  end

  match 'confirmation' => 'confirmations#index', :as => :confirmation
  match 'confirmation/:confirmation_token' => 'confirmations#new', :as => :confirmation
  match 'hostels/:id/preview' => 'bookings#preview', :as => :preview

  resources :inquires
  resources :properties
  resources :testimonials
  resources :feedbacks
  resources :availables
  resources :currencies do
    collection do
      post :update_currency
    end
  end

  resources :destinations
  resources :countries
  resources :confirmations
  resources :searches

  resources :locations do
    collection do
      get :autocomplete
      post :sort
    end
  end

  resources :hostels do
    collection do
      post :update_currency
      post :update_availables
      get :update_search
    end
    resources :bookings
    resources :photos do
      collection do
        post :sort
      end
    end

    resources :reviews
  end

  resources :bookings do
    resource :review
  end

  root :to => "searches#index"

  Mime::Type.register 'application/vnd.google-earth.kml+xml', :kml


end

回答1:

The problem is conflicting String#camelize method in another gem I was using Right-AWS.

Disabled it for now and it works. Also found:

http://groups.google.com/group/plataformatec-devise/browse_thread/thread/d726823ce778597f