Forum: Ruby on Rails skipping filters

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 steve ross (Guest)
on 2006-05-11 08:22
(Received via mailing list)
I have a simple login scheme in application.rb. Something like
:requires_login is called in any controller as a before_filter. All is
good, except I'm having trouble figuring out how to make the public
login actions skip this before filter. Here's what I have:


skip_before_filter :requires_login, :only => [:login, :logout,


before_filter :requires_login, :except => [:list, :show]

I can't successfully pass authentication and what I believe is happening
is that all the right things are happening up till the point of
my_controller.rb, where the :except tells Rails to add all the actions
from application.rb back into the filter chain. I know if I invert the
logic in my_controller to an :only, the auth code in application.rb
works fine.

Q: At what point would the skip... in application.rb be called?
Q: Is there a best practice for doing something like this (other than
the obvious: use login_engine)?
Q: Is there a good place to read about this?

9d1f5d2d9de70bd9a934f557dc95a406?d=identicon&s=25 Daniel ----- (liquid)
on 2006-05-11 08:34
(Received via mailing list)
The way I have done this in the past was:


before_filter :requires_login


before_filter :requires_login, :except => [:login, :logout]

Worked ok for me...  I'm not sure if it has a negative performance hit

On 11 May 2006 06:22:14 -0000, steve ross
This topic is locked and can not be replied to.