module IntercomRails
  class Railtie < Rails::Railtie
    initializer "intercom-rails" do |app|
      ActionView::Base.send :include, ScriptTagHelper
      ActionController::Base.send :include, CustomDataHelper
      ActionController::Base.send :include, AutoInclude::Method
      if ActionController::Base.respond_to? :after_action
        ActionController::Base.after_action :intercom_rails_auto_include
      else
        ActionController::Base.after_filter :intercom_rails_auto_include
      end
    end
  end
end

module IntercomRails
  class Railtie < Rails::Railtie
    initializer "intercom-rails" do |app|
      ActiveSupport.on_load :action_view do
        include ScriptTagHelper
      end
      ActiveSupport.on_load :action_controller do
        include CustomDataHelper
        include AutoInclude::Method

        if respond_to? :after_action
          after_action :intercom_rails_auto_include
        else
          after_filter :intercom_rails_auto_include
        end
      end
    end
  end
end

Make use of ActiveSupport lazy loading
Make use of ActiveSupport lazy loading

this to prevent load order issues. 
More on lazy loading here: https://simonecarletti.com/blog/2011/04/understanding-ruby-and-rails-lazy-load-hooks/