Double redirect

I have two before_filters for my application that both redirect. The
first checks whether there is an active session and if so, whether it
has timed out (a la the recipes book). This is run from
ApplicationController. The second filter is in use throughout most of
the app and checks to see whether the user has the correct credentials
to view the controller. This is run from individual controllers that
need it.

Both have a redirect if they fail, however the redirect for
check_timeout never runs, because it also fails the check_user test
which causes it to redirect and cause the error.

How can I stop the application from running further checks if the first
filter fails? I have tried “redirect_to and return” which was suggested
on a website I found, but it does not seem to alter the situation. It’s
not a showstopper if I can’t, but it would be preferable.



You’ve tried redirect_to and return false?

Return false stops future filters.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs