Skip to content

Instantly share code, notes, and snippets.

@peponi
Created June 8, 2012 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peponi/2895583 to your computer and use it in GitHub Desktop.
Save peponi/2895583 to your computer and use it in GitHub Desktop.
count how many clients come over OS X or Windows
# https://github.com/visionmedia/user-agent
agent = Agent.new request.user_agent
User.os_name = agent.os
User.count(:conditions => "os_name = 'OS X' OR os_name = 'OS X 10.4' OR os_name = 'OS X 10.5' OR os_name = 'OS X 10.6' OR os_name = 'OS X 10.7'")
User.count(:conditions => "os_name = 'Windows 7' OR os_name = 'Windows Vista' OR os_name = 'Windows 2000' OR os_name = 'Windows XP' OR os_name = 'Windows 2003'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment