Method: ActionDispatch::Routing::Mapper#authenticated
- Defined in:
- lib/devise/rails/routes.rb
- (Object) authenticated(scope = nil, block = nil)
Allow you to route based on whether a scope is authenticated. You can optionally specify which scope and a block. The block accepts a model and allows extra constraints to be done on the instance.
authenticated :admin do
root :to => 'admin/dashboard#show', :as => :admin_root
end
authenticated do
root :to => 'dashboard#show', :as => :authenticated_root
end
authenticated :user, lambda {|u| u.role == "admin"} do
root :to => "admin/dashboard#show", :as => :user_root
end
root :to => 'landing#show'
280 281 282 283 284 |
# File 'lib/devise/rails/routes.rb', line 280 def authenticated(scope=nil, block=nil) constraints_for(:authenticate?, scope, block) do yield end end |