1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Don't require explicit scope in authenticate router extension

This commit is contained in:
Alexander Uvarov 2011-08-10 15:34:40 +06:00
parent ff90d9da9c
commit d38341b5e0
2 changed files with 7 additions and 3 deletions

View file

@ -205,11 +205,15 @@ module ActionDispatch::Routing
# Allow you to add authentication request from the router:
#
# authenticate(:user) do
# authenticate do
# resources :post
# end
#
def authenticate(scope)
# authenticate(:admin) do
# resources :users
# end
#
def authenticate(scope=nil)
constraint = lambda do |request|
request.env["warden"].authenticate!(:scope => scope)
end

View file

@ -4,7 +4,7 @@ Rails.application.routes.draw do
get :expire, :on => :member
get :accept, :on => :member
authenticate :user do
authenticate do
post :exhibit, :on => :member
end
end