Merge pull request #1258 from wildchild/master

Don't require explicit scope in authenticate router extension
This commit is contained in:
José Valim 2011-08-10 05:23:29 -07:00
commit 31e4ef5e4b
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: # Allow you to add authentication request from the router:
# #
# authenticate(:user) do # authenticate do
# resources :post # resources :post
# end # end
# #
def authenticate(scope) # authenticate(:admin) do
# resources :users
# end
#
def authenticate(scope=nil)
constraint = lambda do |request| constraint = lambda do |request|
request.env["warden"].authenticate!(:scope => scope) request.env["warden"].authenticate!(:scope => scope)
end end

View File

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