Skip to content

Instantly share code, notes, and snippets.

@zxiest
Created March 23, 2011 17:05
Show Gist options
  • Save zxiest/883483 to your computer and use it in GitHub Desktop.
Save zxiest/883483 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