Rafael Carício
Rafael Carício

Reputation: 100

skip after_filter in controller before_filter

I'm using Intercom rails in my application and I would like to not include intercom script in a certain situation. So, I would like to skip the intercom after_filter when a value is set in the user session. I tried that, but it didn't worked:

class ApplicationController < ActionController::Base
  before_filter :verify_session

  def verify_session
    if skip_intercom?
      self.class.skip_after_filter :intercom_rails_auto_include
    end
  end
end

Any idea if it's possible?

Upvotes: 1

Views: 515

Answers (2)

Ravindra
Ravindra

Reputation: 1049

@Rafael Caricio i faced the same issue but later i have added the below filter in all of my controllers where i don't want intercom to add:

skip_after_filter :intercom_rails_auto_include

and it is working fine for me

Upvotes: 1

Deej
Deej

Reputation: 5352

Where is the intercom_rails_auto_include being set? Because Could you not just put skip_after_filter_intercom_rails_auto_include at the top your of your application controller. Or alternatively try and do the following skip_after_filter IntercomRails::AutoIncludeFilter at the top of your controller.

Upvotes: 0

Related Questions