# Double redirect

**URL:** <https://www.ruby-forum.com/t/double-redirect/93844>\
**Category:** Rails\
**Created:** [April 11, 2006, 9:55pm UTC](https://www.ruby-forum.com/t/double-redirect/93844 "2006-04-11T21:55:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [April 11, 2006, 9:55pm UTC](https://www.ruby-forum.com/t/double-redirect/93844/1 "2006-04-11T21:55:22Z")

</div>

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.

Thanks,

David

---

<div class="post-metadata">

**Author:** ![david](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/aeb1de/32.png) [@david](https://www.ruby-forum.com/u/david)\
**Post date:** [April 11, 2006, 9:58pm UTC](https://www.ruby-forum.com/t/double-redirect/93844/2 "2006-04-11T21:58:17Z")

</div>

You’ve tried redirect\_to and return false?

Return false stops future filters.
