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.
Active Record, of course. Any version 2 or 3 will do.
or in your Gemfile:
I told you installation would be easy.
Comment.randomizr # => look ma, a random comment!
Copyright © 2011 Joost Baaij, released under the MIT license