Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#robot?Boolean

Return true if the user agent is a bot.

Returns:

  • (Boolean)

14
15
16
17
# File 'app/controllers/application_controller.rb', line 14

def robot?
  bot = /(Baidu|bot|Google|SiteUptime|Slurp|WordPress|ZIBB|ZyBorg)/i
  request.user_agent =~ bot
end