class ActionController::Routing::RouteSet::Mapper

def devise_for(*resources)

map.devise_for :users, :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification' }

* :path_names => configure different path names to overwrite defaults :sign_in, :sign_out, :password and :confirmation.

map.devise_for :users, :singular => :account

* :singular => setup the name used to create named routes. By default, for a :users key, it is going to be the singularized version, :user. To configure a named route like account_session_path instead of user_session_path just do:

map.devise_for :users, :as => 'accounts'

* :as => allows you to setup path name that will be used, as rails routes does. The following route configuration would setup your route as /accounts instead of /users:

map.devise_for :users, :class_name => 'Account'

* :class_name => setup a different class to be looked up by devise, if it cannot be correctly find by the route name.
You can configure your routes with some options:

POST /users/confirmation(.:format) {:controller=>"confirmations", :action=>"create"}
user_confirmation GET /users/confirmation(.:format) {:controller=>"confirmations", :action=>"show"}
new_user_confirmation GET /users/confirmation/new(.:format) {:controller=>"confirmations", :action=>"new"}
# Confirmation routes for Confirmable, if User model has :confirmable configured

POST /users/password(.:format) {:controller=>"passwords", :action=>"create"}
user_password PUT /users/password(.:format) {:controller=>"passwords", :action=>"update"}
edit_user_password GET /users/password/edit(.:format) {:controller=>"passwords", :action=>"edit"}
new_user_password GET /users/password/new(.:format) {:controller=>"passwords", :action=>"new"}
# Password routes for Recoverable, if User model has :recoverable configured

destroy_user_session GET /users/sign_out {:controller=>"sessions", :action=>"destroy"}
user_session POST /users/sign_in {:controller=>"sessions", :action=>"create"}
new_user_session GET /users/sign_in {:controller=>"sessions", :action=>"new"}
# Session routes for Authenticable (default)

needed routes:
this method is going to look inside your User model and create the

map.devise_for :users

inside your routes:
authenticable, confirmable and recoverable modules. After creating this
Examples: Let's say you have an User model configured to use
defined in your model.
generate all needed routes for devise, based on what modules you have
Includes devise_for method for routes. This method is responsible to
:doc:
def devise_for(*resources)
  options = resources.extract_options!
  resources.map!(&:to_sym)
  options.assert_valid_keys(:class_name, :as, :path_names, :singular)
  resources.each do |resource|
    mapping = Devise::Mapping.new(resource, options)
    Devise.mappings[mapping.name] = mapping
    if mapping.authenticable?
      with_options(:controller => 'sessions', :path_prefix => mapping.as) do |session|
        session.send(:"new_#{mapping.name}_session",     mapping.path_names[:sign_in],  :action => 'new',     :conditions => { :method => :get })
        session.send(:"#{mapping.name}_session",         mapping.path_names[:sign_in],  :action => 'create',  :conditions => { :method => :post })
        session.send(:"destroy_#{mapping.name}_session", mapping.path_names[:sign_out], :action => 'destroy', :conditions => { :method => :get })
      end
    end
    namespace mapping.name, :namespace => nil, :path_prefix => mapping.as do |m|
      if mapping.recoverable?
        m.resource :password, :only => [:new, :create, :edit, :update], :as => mapping.path_names[:password]
      end
      if mapping.confirmable?
        m.resource :confirmation, :only => [:new, :create, :show], :as => mapping.path_names[:confirmation]
      end
    end
  end
end