-
Notifications
You must be signed in to change notification settings - Fork 0
Find a random record with ActiveRecord
License
hgmnz/fast_random
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
fast_random ========== This plugin extends active record by adding a class level random method which returns a random record from the database. The approach taken performs better than 'order by rand() limit 1' for large datasets. It uses offset instead of an order by to retrieve the random record in a database agnostic way. Example ======= class Foo < ActiveRecord::Base; end Foo.random Copyright (c) 2009 Harold A. Gimenez, released under the MIT license
About
Find a random record with ActiveRecord
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published