The tests for this feature and the implementation of around_filters
use controller.__send__, so you''ll likely need the same. The
documentation appears to be incorrect...
--Matt Jones
On Jul 10, 5:56 pm, Bill Kocik
<bko...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> I''m defining an around filter as its own class. The documentation
on
> ActionController::Filters::ClassMethods includes this example:
>
> class Authorizer
> # This will run before the action. Redirecting aborts the action.
> def before(controller)
> unless user.authorized?
> redirect_to(login_url)
> end
> end
>
> # This will run after the action if and only if before did not
> render or redirect.
> def after(controller)
> end
> end
>
> It also includes the explanatory text, "If before renders or
> redirects, the filter chain is halted and after will not be run"
> implying that these filters can render. What I''m not clear on is
how.
>
> In my class, calls to render result in a no such method error. I tried
> calling controller.render, and it turns out that''s protected. I
can
> get around this using send, but I doubt that''s actually the right
way.
> Does anyone happen to know what the right way is?