Is it possible to have to have the root url configured so that the user
is directed to a different page depending if they are logged in or not
whilst also keeping the url the same?
At the moment I have the root url configured to be the Users#show action
and I have a ‘login_required’ before filter on the Users#show action
which redirects the user to Sessions#new if the user is not logged in.
This works well but the URL is changed when the user is directed and so
all nonlogged in users see www.example.com/login as the url when they
come to the site. I want everybody to see www.example.com regardless of
whether they are logged in or not.
map.root :controller => ‘users’, :action => ‘show’
map.login ‘/login’, :controller => ‘sessions’, :action => ‘new’