Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

SQL compliant random Active Record

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 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.