Class: Avatar

Inherits:
ApplicationRecord show all
Includes:
WithTargetAudience
Defined in:
app/models/avatar.rb

Class Method Summary collapse

Methods inherited from ApplicationRecord

active_between, aggregate_of, all_except, defaults, #delete, #destroy!, enum_prefixed_translations_for, numbered, organic_on, resource_fields, #save, #save_and_notify!, #save_and_notify_changes!, serialize_symbolized_hash_array, teaser_on, #update_and_notify!, update_or_create!, whitelist_attributes, with_pg_retry, with_temporary_token

Methods included from WithPgLock

#with_pg_lock

Class Method Details

.sampleObject



10
11
12
# File 'app/models/avatar.rb', line 10

def self.sample
  order('RANDOM()').first
end

.sample_for(user) ⇒ Object



6
7
8
# File 'app/models/avatar.rb', line 6

def self.sample_for(user)
  with_current_audience_for(user).sample
end