Before_filter halts chain but won't perform redirect_to properly

I have implemented a simple admin before filter like the one shown on
railscasts.com at #20 Restricting Access - RailsCasts &
#21 Super Simple Authentication - RailsCasts

but I find that the redirect_to in my authorize function causes the the
Filter chain to halt and loop through 20 times with 302 errors trying to
redirect to home_path before it stops and does not render anything
with
this error

Filter chain halted as
[#<ActionController::Filters::ClassMethods::SymbolFilter:0x2aaaabe7b2f8
@filter=:my_authenticate>] rendered_or_redirected.

issues_controller.rb

before_filter :my_authenticate , :except => {:index, :show}


application.rb

def my_authenticate
unless admin?
flash[:error] = “unauthorized access”
redirect_to home_path
false
end
end

if I comment out *redirect_to home_path *the app works, but non
normal users can access admin paths

any tips on why redirect_to breaks the filter chain so

i’m running rails 2.0.2

DHH says http://www.ruby-forum.com/topic/128746 so I’d assume the
problem I’m seeing should be fixed

cheers

dion

Based on the fact that it loops dozens of times, is this (or a similar)
filter possibly in effect for home_path as well? I.e.,

/issues/new -> filter -> /home -> filter -> /home -> filter … ad
nauseam

that must be the problem…as the filter is in the same controller as
the
redirect controller – my root

so I guess the filter is being called over and over…

i’ll try a different tactic now…

cheers

On Wed, Apr 23, 2008 at 1:17 AM, Jan F.
[email protected]