ActionController inherit before_filter

I have something like this:

This strikes me as odd - I wouldn’t usually call a parent controller’s action explicitly. Either the base controller would implement some non action methods that I’d call or I’d call the base controller functionality via super.

Having said that, it was my recollection that filters were handled by Action Controller’s perform_action so I wouldn’t have expected what you saw either


Thanks for your feedback Fred.

I should have added that I'm using very old Ruby (1.8.7) and Rails (2.2.2) versions.

Also, I tried to make my example as simple as possible. In reality, it is a little more complicated.

The error is that...

...if I invoke an action on the UserController which is implemented in its base controller, even if the base controller has a before_filter excluding auth_check to run for that action it will still be run unless UserController explicitly excludes the auth_check from running for the inherited action.

I've been debugging this and can see that the debugger first processes BaseController.before_filter followed by UserController.before_filter but I don't know how the filters are stored and chained. I think that is where the problem is.


That makes more sense and is now sounding like something i’d expect. You might try using skip_before_filter .