Alain Ravet
2006-May-17 11:29 UTC
[Rails] class filter: cannot call protected controller methods
Greetins all, I''m rewriting a filter from the method form to a class filter.(see below) Problem: some controller - redirect_to - and route - *_url - methods are protected (redirect_to, f.ex.), and cannot be called. Is this intended? Is there a solution workaround? TIA Alain BEFORE: ----------- before_filter :login_required, :except => [:welcome,:login] def login_required unless current_user session[:jumpto] = request.parameters redirect_to login_invite_url end end AFTER (does not compile) ----------- class AuthenticationFilter def self.filter(controller) login_required = [''welcome'',''login''].include?(controller.action_name) if login_required && !controller.current_user controller.session[:jumpto] = controller.request.parameters controller.redirect_to controller.login_invite_url <<<<------- ERROR : DOES NOT COMPILE !! end end end before_filter AuthenticationFilter -- Posted via http://www.ruby-forum.com/.