How to skip a before_filter for Devise's SessionsController?

Spyros picture Spyros · Jun 2, 2011 · Viewed 17.1k times · Source

I have a before_filter in my ApplicationController; that is, for every controller in my project.

How can I skip_before_filter for Devise's SessionsController create action ?

Answer

Nathan Long picture Nathan Long · Jul 18, 2011

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