Getting a random record using datamapper
Thursday 11/27/2008 – Category: Uncategorized
Model.get(1+rand(Model.count))
You'll have to have dm-aggregates for Model.count to work correctly
Leave a Reply
Recent Posts
- LED Light for iPhone 4
(Monday 06/28/2010 – 38 Comments) - WWDC 2010: Worth Every Minute
(Monday 06/14/2010 – No Comments) - Flickr Original for Safari 5!
(Wednesday 06/9/2010 – 15 Comments) - iPad thoughts
(Friday 04/2/2010 – 1 Comment)
