Module: BrowserWarrior::Controllers::Helpers

Extended by:
ActiveSupport::Concern
Defined in:
lib/browser_warrior.rb

Instance Method Summary collapse

Instance Method Details

#check_browser_warrior!Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/browser_warrior.rb', line 16

def check_browser_warrior!
  # ignore rails inline controller
  if params[:controller] == 'rails/welcome'
    return
  end

  # ignore no html controller
  if params[:format].present? && params[:format] != :html
    return
  end

  # ignore non-get request
  if ! request.get?
    return
  end

  browser = ::Browser.new(request.user_agent)
  if ! BrowserWarrior.do_detect(browser)
    render 'browser_warrior/index', layout: false
  end
end