Skip to content

Instantly share code, notes, and snippets.

@trevorturk
Created April 7, 2010 04:04
Show Gist options
  • Save trevorturk/358505 to your computer and use it in GitHub Desktop.
Save trevorturk/358505 to your computer and use it in GitHub Desktop.
module ActiveRecord
class Base
def self.random
if (c = count) != 0
find(:first, :offset =>rand(c))
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment