mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-10 07:18:14 -05:00
devise_for now accepts a block. All routes inside the block uses the scope defined by devise_for.
You are now allowed to do:
devise_for :users do
# Non conventional sign_in route
get "/sign_in" => "devise/sessions#new"
end
And it should work as expected.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Rails.application.routes.draw do
|
||||
# Resources for testing
|
||||
resources :users, :only => [:index] do
|
||||
get :expire, :on => :member
|
||||
get :accept, :on => :member
|
||||
@@ -6,9 +7,28 @@ Rails.application.routes.draw do
|
||||
|
||||
resources :admins, :only => [:index]
|
||||
|
||||
devise_for :users
|
||||
# Users scope
|
||||
devise_for :users do
|
||||
match "/devise_for/sign_in", :to => "devise/sessions#new"
|
||||
end
|
||||
|
||||
as :user do
|
||||
match "/as/sign_in", :to => "devise/sessions#new"
|
||||
end
|
||||
|
||||
match "/sign_in", :to => "devise/sessions#new"
|
||||
|
||||
# Admin scope
|
||||
devise_for :admin, :path => "admin_area", :controllers => { :sessions => "sessions" }, :skip => :passwords
|
||||
|
||||
match "/admin_area/home", :to => "admins#index", :as => :admin_root
|
||||
match "/anywhere", :to => "foo#bar", :as => :new_admin_password
|
||||
|
||||
authenticate(:admin) do
|
||||
match "/private", :to => "home#private", :as => :private
|
||||
end
|
||||
|
||||
# Other routes for routing_test.rb
|
||||
namespace :publisher, :path_names => { :sign_in => "i_don_care", :sign_out => "get_out" } do
|
||||
devise_for :accounts, :class_name => "User", :path_names => { :sign_in => "get_in" }
|
||||
end
|
||||
@@ -23,15 +43,5 @@ Rails.application.routes.draw do
|
||||
}
|
||||
end
|
||||
|
||||
match "/admin_area/home", :to => "admins#index", :as => :admin_root
|
||||
match "/sign_in", :to => "devise/sessions#new"
|
||||
|
||||
# Dummy route for new admin pasword
|
||||
match "/anywhere", :to => "foo#bar", :as => :new_admin_password
|
||||
|
||||
root :to => "home#index"
|
||||
|
||||
authenticate(:admin) do
|
||||
match "/private", :to => "home#private", :as => :private
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user