Created
May 24, 2010 18:07
-
-
Save wildchild/412211 to your computer and use it in GitHub Desktop.
Do you like it?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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