Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
SQL compliant random Active Record
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
Gemfile
README.rdoc
Rakefile
randomizr.gemspec

README.rdoc

Randomizr

Returns one random Active Record object using cross-platform ANSI compliant SQL.

We have all used order by rand() to select a random record from time to time. We know we shouldn't, but it was just too easy. Well no more. NO MORE. It's now easier to do it properly by just using this gem. That's right. It will solve all your ansi-sql troubles and put that smile back on your face.

Prerequisites

Active Record, of course. Any version 2 or 3 will do.

Installation

config.gem 'randomizr'

or in your Gemfile:

gem 'randomizr'

I told you installation would be easy.

Examples

Comment.randomizr     # => look ma, a random comment!

Copyright © 2011 Joost Baaij, released under the MIT license

Something went wrong with that request. Please try again.