views:

27

answers:

2

I have a Pages controller, with an action/view called home. I have set this as the root of the site with

map.root :controller => "pages", :action => "home"

At the moment, I am using this page as part of the logged in user's workflow, thus it is required for the user to be logged in to see it.

But I also need the root path to serve as the landing page for new users, with signup links/promotional stuff etc. Is this a good idea? Should I not be using it the way I am (as part of the logged in user's workflow)? Is the best way to do it just to do a check to see if there's a logged in user, and change the display appropriately?

Thanks for reading.

A: 

It's a personal preference, but I'd say the root page should be viewable by non-authenticated users. You could then have a before filter on the root page to redirect to the logged in user's home page if there is a current_user.

luke_randall
He means to show it like Twitter does. A different page when logged in and different otherwise.
Swanand
A: 

You can redirect the user to another action based on their login status. Or you can create two views, and render the appropriate one:
render :template => 'logged_in'

Faisal