This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 79943eb6cbadc4b55f158a4e9fcde6206c60fa51
tree 477b26c581a403725968ba7e832192c7207759d5
parent 3aaa4636d12318b890065aac703cddc6b3d851d9
tree 477b26c581a403725968ba7e832192c7207759d5
parent 3aaa4636d12318b890065aac703cddc6b3d851d9
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
MIT-LICENSE | ||
| |
README | ||
| |
Rakefile | ||
| |
init.rb | ||
| |
install.rb | ||
| |
lib/ | ||
| |
tasks/ | ||
| |
test/ | ||
| |
uninstall.rb |
README
*random_items* is a Rails plugin which allows to pick random items from an ActiveRecord model (without using <tt>:order => "RAND()"</tt> which is not a good idea in terms of performance). The interface is almost the same as that of <tt>ActiveRecord::Base.find</tt>. Some examples: Picking a random item: Model.random(:first) Picking 5 random items: Model.random(:all, :limit => 5) Pickings a random item using standard <tt>ActiveRecord::Base.find</tt> options, such as <tt>:include</tt> Model.random(:first, :include => :relation) In that last case, you are expected not to use options which don't make sense, such as <tt>:order</tt> =;-) Copyright (c) 2008 Sergio Gil, released under the MIT license








