Mercurial > hg > soundsoftware-site
diff app/helpers/attachments_helper.rb @ 969:e632838adb35 cannam
Merge from branch "live"
author | Chris Cannam |
---|---|
date | Wed, 17 Oct 2012 10:42:55 +0100 |
parents | 19884e9d5eff |
children | bb32da3bea34 |
line wrap: on
line diff
--- a/app/helpers/attachments_helper.rb Tue Oct 16 16:47:33 2012 +0100 +++ b/app/helpers/attachments_helper.rb Wed Oct 17 10:42:55 2012 +0100 @@ -42,4 +42,11 @@ api.created_on attachment.created_on end end + + # Returns true if user agent appears (approximately) to be a search + # bot or crawler + def user_is_search_bot? + agent = request.env['HTTP_USER_AGENT'] + agent and agent =~ /(bot|slurp|crawler|spider)\b/i + end end