Rails select random record

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?

@user = User.random

Or... well since that method doesn't exist is there some amazing "Rails Way" of doing this, I always seem to be to verbose. I'm using mysql as well.

17
задан shamittomar 4 September 2010 в 05:38
поделиться