I don\'t know if I\'m just looking in the wrong places here or what, but does active record have a method for retrieving a random object?
Something like?
<
In Rails 4 I would extend ActiveRecord::Relation:
ActiveRecord::Relation
class ActiveRecord::Relation def random offset(rand(count)) end end
This way you can use scopes:
SomeModel.all.random.first # Return one random record SomeModel.some_scope.another_scope.random.first