Sha256: e2de079e0cfeb59d93e66e12d2c65e75dd625f396760e0bb4906d7d2f8231733

Contents?: true

Size: 379 Bytes

Versions: 2

Compression:

Stored size: 379 Bytes

Contents

module Ahoy
  class BaseController < ApplicationController
    # skip all filters
    skip_filter *_process_action_callbacks.map(&:filter)

    before_filter :halt_bots

    protected

    def browser
      @browser ||= Browser.new(ua: request.user_agent)
    end

    def halt_bots
      if !Ahoy.track_bots and browser.bot?
        render json: {}
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ahoy_matey-0.2.2 app/controllers/ahoy/base_controller.rb
ahoy_matey-0.2.1 app/controllers/ahoy/base_controller.rb