# Can befor\_filter expect other controller's action?

**URL:** <https://www.ruby-forum.com/t/can-befor-filter-expect-other-controllers-action/55703>\
**Category:** Rails\
**Created:** [March 23, 2006, 3:44am UTC](https://www.ruby-forum.com/t/can-befor-filter-expect-other-controllers-action/55703 "2006-03-23T03:44:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bin.liu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/43a26b/32.png) [@bin.liu](https://www.ruby-forum.com/u/bin.liu)\
**Post date:** [March 23, 2006, 3:44am UTC](https://www.ruby-forum.com/t/can-befor-filter-expect-other-controllers-action/55703/1 "2006-03-23T03:44:02Z")

</div>

i put  
befor\_filter :setup\_user,:except=\>:login  
in ApplicationController.rb  
but i want to put action login to other controller  
how can i do it?  
does rails has this support?  
befor\_filter  
:setup\_user,:except=\>{{controller=\>‘user’,action=\>‘login’},…}

---

<div class="post-metadata">

**Author:** ![bin.liu](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/43a26b/32.png) [@bin.liu](https://www.ruby-forum.com/u/bin.liu)\
**Post date:** [March 23, 2006, 1:05pm UTC](https://www.ruby-forum.com/t/can-befor-filter-expect-other-controllers-action/55703/2 "2006-03-23T13:05:37Z")

</div>

Am Donnerstag, den 23.03.2006, 03:44 +0100 schrieb bin.liu:

> i put  
> befor\_filter :setup\_user,:except=\>:login  
> in ApplicationController.rb  
> but i want to put action login to other controller  
> how can i do it?  
> does rails has this support?  
> befor\_filter  
> :setup\_user,:except=\>{{controller=\>‘user’,action=\>‘login’},…}

No it is not supported, but you could define the logic of your action in  
the application controller and call it from any login action of your  
child controllers.

## The question is: Do you have different login actions in your controllers? Why do you want to only exclude the login action on your user controller?

Norman T.

[http://blog.inlet-media.de](http://blog.inlet-media.de)
