Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
13 lines (11 sloc) 301 Bytes
class RandomUser
acts_as_cached
# Grab X random users in network Y
def self.grab_from_network(id, options = {})
sex = options[:sex] || ''
key = regional_key(id, sex)
ids = fetch_cache(key) || []
limit = options[:limit] || 10
(0...limit).to_a.map { ids.rand }
end
end