# ActionController::Filters, any methods to execute the chain?

**URL:** <https://www.ruby-forum.com/t/actioncontroller-filters-any-methods-to-execute-the-chain/108228>\
**Category:** Rails\
**Created:** [June 30, 2007, 6:05pm UTC](https://www.ruby-forum.com/t/actioncontroller-filters-any-methods-to-execute-the-chain/108228 "2007-06-30T18:05:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [June 30, 2007, 6:05pm UTC](https://www.ruby-forum.com/t/actioncontroller-filters-any-methods-to-execute-the-chain/108228/1 "2007-06-30T18:05:09Z")

</div>

Does anyone know if there is a method to execute a target method on a  
controller, through the filter logic.

Say I want to execute the “list” method, but first have it go through  
the all the filter logic. Is there a method on ActionController::Filters  
to do this?

Thanks

---

<div class="post-metadata">

**Author:** ![ktheory](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e480ec/32.png) [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Post date:** [June 30, 2007, 7:01pm UTC](https://www.ruby-forum.com/t/actioncontroller-filters-any-methods-to-execute-the-chain/108228/2 "2007-06-30T19:01:13Z")

</div>

Aaron S. wrote:

> Does anyone know if there is a method to execute a target method on a  
> controller, through the filter logic.
> 
> Say I want to execute the “list” method, but first have it go through  
> the all the filter logic. Is there a method on ActionController::Filters  
> to do this?
> 
> Thanks

More info::

I’m developing a rails plugin and I need to hijack the filter chain. I  
load a Controller dynamically and need to be able to execute the filter  
chain.

Ex:

load(‘my\_controller’)  
@clazz = Object.const\_get(‘MyController’)  
@clazz.filter\_chain.each do |filter|  
res = filter.call(@clazz, ?)  
if !res  
return  
else  
@clazz.myAction()  
end  
end

So I’m wondering if looping through the filter\_chain is the best way to  
do this? Is there a method to handle this for me? I don’t really see one  
in the source, but maybe somebody knows how…

Any ideas?

Thanks
