Specify which controllers to exclude from before_filter

后端 未结 4 647
無奈伤痛
無奈伤痛 2020-12-13 01:11

I\'m using devise for authentication and have some before_filters in my application controller. Issue I\'m seeing is that when I try to logout the before_filter intercepts t

4条回答
  •  再見小時候
    2020-12-13 01:20

    You can qualify a filter with :only or :except.

    before_filter :filter_name, :except => [:action1, :action2]
    

    Or if the filter (as I now see is the case in your situation) is defined in ApplicationController and you want to bypass it in a subclass controller, you can use a skip_before_filter with the same qualifications in the subclass controller:

    skip_before_filter :filter_name, :except => [:action1, :action2]
    

提交回复
热议问题