github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

collectiveidea / random_finders

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 11
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Click here to lend your support to: random_finders and make a donation at www.pledgie.com ! Edit Pledgie Setup

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

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

  cancel

http://daniel.collectiveidea.com/blog/tags/random_finders

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Fixed silly typo, exposing lax test coverage [mark van holstyn] 
danielmorrison (author)
Wed Jun 06 11:47:01 -0700 2007
commit  d5c6975eba945bc02d513b13a9c8f48f9153b7c6
tree    b7296f11dd902a2806072c556bbc642a60a5eac4
parent  c39cb222789479a56e664ff0b9499128adb13409
random_finders /
name age
history
message
file MIT-LICENSE Loading commit data...
file README
file Rakefile
file init.rb
directory lib/
directory tasks/
directory test/
README
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
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server