I have a Ruby on Rails Controller with a before_filter using a custom class:
class ApplicationController
before_filter CustomBeforeFilter
end
I have another controller inherited from ApplicationController, where I would like to skip the CustomBeforeFilter:
class AnotherController < ApplicationController
skip_before_filter CustomBeforeFilter
end
That doesn’t work. The before_filter is still executed.
How can I skip a Ruby on Rails before filter that uses a custom class?
Class callbacks are assigned a random callback name when they are added to the filter chain. The only way I can think of to do this is to find the name of callback first:
If you want something a little cleaner in your controllers, you could override the skip_before_filter method in ApplicationController and make it available to all controllers:
Then you could do: