I have used restful-authentication and I have "public" layout and a completely different "members" layout. When someone visits my root (defaults to public) how can I check if they are logged in and redirect them to the member's section?
A:
You could define a method like this in application_controller.rb:
private
def require_user
# logic to check if session exists and redirect if not
end
Then add the following in your pages that require that the user be logged in:
before_filter :require_user
I'm not familiar with restful-auth so I don't know the exact check that would be required.
Good luck.
cakeforcerberus
2009-07-25 22:48:09
+2
A:
RestfulAuthentication provides some conditional methods/helpers including one called logged_in?
. It returns true if the user is logged in.
Check out the authenticated_system.rb
file for the list of all available methods.
Simone Carletti
2009-07-25 22:52:07