Skip to content

Instantly share code, notes, and snippets.

@wildchild
Created May 24, 2010 18:07
Show Gist options
  • Save wildchild/412211 to your computer and use it in GitHub Desktop.
Save wildchild/412211 to your computer and use it in GitHub Desktop.
Do you like it?
module ActionDispatch::Routing
class Mapper
def authenticate(scope = Devise.default_scope)
constraint = lambda do |request|
request.env["warden"].authenticate!(:scope => scope)
end
constraints(constraint) do
yield
end
end
end
end
authenticate do
resource :profile
end
authenticate(:admin) do
namespace :admin do
match "/dashboard", :to => "dashboard#index", :as => :dashboard
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment