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