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