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

0 views
Skip to first unread message

Aaron Smith

unread,
Jun 30, 2007, 12:05:09 PM6/30/07
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.

Aaron Smith

unread,
Jun 30, 2007, 1:01:13 PM6/30/07
to rubyonra...@googlegroups.com
Aaron Smith 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?

Reply all
Reply to author
Forward
0 new messages