Skip to content

A Rails plugin that allows quick and easy fetching of random records, or records in random order.

License

Notifications You must be signed in to change notification settings

doz/random_finders

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RandomFinders
=============

Allows quick and easy fetching of random records, or records in random order.

Simply pass the :random to the order in any finder method.

Examples
========

Find a random article
  Article.find(:first, :order => :random)
  
Randomize photos
  Photo.find(:all, :order => :random)
  

Caveat
======

This will not treat you nicely with large datasets.  

Read about it here:
http://daniel.collectiveidea.com/blog/tags/random_finders



Based on an idea by Mike Burns
http://mikeburnscoder.wordpress.com/2006/08/18/retrieving-random-elements-from-an-activerecord/

Copyright (c) 2007 Daniel Morrison, Collective Idea (http://collectiveidea.com), released under the MIT license

About

A Rails plugin that allows quick and easy fetching of random records, or records in random order.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%