[Boulder Ruby Group] rendering now!
ara.t.howard
ara.t.howard at gmail.com
Fri Jun 29 02:35:53 EDT 2007
On Jun 29, 2007, at 12:13 AM, Bruce Williams wrote:
> Ara,
>
> The filter needs to return false to stop the action dispatch.
>
> Here's a working example (just played with it):
>
> --snip--
> class FoosController < ApplicationController
>
> before_filter :authenticate
>
> def index
> # won't get here
> end
>
> #######
> private
> #######
>
> def can_find_account # stub, use some method that's useful
> return false
> end
>
> def authenticate
> unless can_find_account
> render :template => 'shared/access_denied'
> return false
> end
> end
>
> end
> --snip--
>
cool - the return false was the key.
> I generally like rendering directly vs redirection in these cases.
yeah - that's totally where i'm at too.
thanks a bunch!
-a
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/bdrg-members/attachments/20070629/0ad02add/attachment.html
More information about the Bdrg-members
mailing list