How to skip a before_filter for Devise's SessionsController?

Here's a method my colleague just showed me:

# In config/application.rb
module YourAppNameHere
  class Application < Rails::Application
  # Whatever else is already here...

    # The part to add
    config.to_prepare do
      Devise::SessionsController.skip_before_filter :your_before_filter_here
    end
  end
end

I recently had this problem with filter in my application_controller I solved it using skip_before_filter

skip_before_filter :check_subdomain!, if: :devise_controller?

We did something like this:

First up, create your own session controller, make sure to inherit correctly:

class SessionsController < Devise::SessionsController
  skip_before_filter :foobar

Then fix the routes

devise_for :users,
  :controllers => {
    :sessions => "sessions"
  }

Alternatively you could monkey-patch Devise's session controller.