Module: Dynomite::Item::Id

Extended by:
ActiveSupport::Concern
Defined in:
lib/dynomite/item/id.rb

Instance Method Summary collapse

Instance Method Details

#generate_idObject



15
16
17
# File 'lib/dynomite/item/id.rb', line 15

def generate_id
  "#{id_prefix}-#{SecureRandom.alphanumeric(16)}"
end

#id_prefixObject



19
20
21
# File 'lib/dynomite/item/id.rb', line 19

def id_prefix
  self.class.id_prefix_value
end

#set_idObject



10
11
12
13
# File 'lib/dynomite/item/id.rb', line 10

def set_id
  return if self.class.disable_id?
  self.id ||= generate_id
end