Skip to content

Commit

Permalink
Don't require explicit scope in authenticate router extension
Browse files Browse the repository at this point in the history
  • Loading branch information
wildchild committed Aug 10, 2011
1 parent ff90d9d commit d38341b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/devise/rails/routes.rb
Expand Up @@ -205,11 +205,15 @@ def devise_for(*resources)

# 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
Expand Down
2 changes: 1 addition & 1 deletion test/rails_app/config/routes.rb
Expand Up @@ -4,7 +4,7 @@
get :expire, :on => :member
get :accept, :on => :member

authenticate :user do
authenticate do
post :exhibit, :on => :member
end
end
Expand Down

0 comments on commit d38341b

Please sign in to comment.