Redirect problem

Hi all

I’ve got the following problem:
With this method i check if a user is logged in. If not, he will be
redirected to home:
def check_login
if logged_in?
true
else
redirect_to root_path
end
end

Now the problem is: When i call this method in an other method where
is a next redirect_to or a render-command, the error “Can only render
or redirect once per action” occures.

Is there something like the “die()”-Command in PHP for stopping the
execution-process after the first redirect?

Anyone an idea?

greets
sigma

as far as i concern, double redirection is not allowed in rails. We
usually check the login method in before_filter and we do not call it
from within another method. So, I believe if u user before_filter, the
problem will fly

cheers
shuaib

Ok, this would be a solution :wink:

Thank you!