forked from collectiveidea/random_finders
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
31 lines (18 loc) · 703 Bytes
/
Copy pathREADME
File metadata and controls
31 lines (18 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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