ruby-on-railsruby-on-rails-3

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 work:

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?


Solution

  • 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.