Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip a before_filter for Devise's SessionsController?

Tags:

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 ?

like image 783
Spyros Avatar asked Jun 02 '11 02:06

Spyros


2 Answers

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
like image 64
Nathan Long Avatar answered Sep 17 '22 15:09

Nathan Long


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?
like image 30
Kamil Sarna Avatar answered Sep 21 '22 15:09

Kamil Sarna