class ActionDispatch::Routing::Mapper
def unauthenticated(scope = nil)
root to: 'dashboard#show'
end
end
root to: 'devise/registrations#new'
as :user do
unauthenticated do
You can optionally specify which scope.
Allow you to route based on whether a scope is *not* authenticated.
def unauthenticated(scope = nil) constraint = lambda do |request| not request.env["warden"].authenticate? scope: scope end constraints(constraint) do yield end end