Skip to content

Instantly share code, notes, and snippets.

@xwmx
Created June 1, 2009 21:01
Show Gist options
  • Save xwmx/121792 to your computer and use it in GitHub Desktop.
Save xwmx/121792 to your computer and use it in GitHub Desktop.
# get a random record from a table
Item.first(:offset => ( Item.count * rand ).to_i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment