-
Notifications
You must be signed in to change notification settings - Fork 0
Find a random record with ActiveRecord
License
hgmnz/fast_random
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