First i thought using the browser-gem and browser.bot? would give me the correct answer. But somehow it did not work. So i am now using this litte snippet to detect bots.
5 | matches = agent.match(/(facebook|postrank|voyager|twitterbot|googlebot|slurp|butterfly|pycurl|tweetmemebot|metauri|evrinid|reddit|digg|sitebot|msnbot|robot)/mi) if agent |
6 | return (agent. nil ? or matches) |
In my Base-Controller:
2 | uAgent = request.env[ "HTTP_USER_AGENT" ] |
6 | BotDetection.bot?(uAgent) |
A list of user-agents may be found at http://www.user-agents.org/