Module: Shared::AutoUuid

Extended by:
ActiveSupport::Concern
Included in:
AnatomicalPart, BiologicalAssociation, Extract, Otu
Defined in:
app/models/concerns/shared/auto_uuid.rb

Overview

If included ensures Object allways has a UUID

Instance Method Summary collapse

Instance Method Details

#create_object_uuidObject (private)



32
33
34
35
36
37
38
39
# File 'app/models/concerns/shared/auto_uuid.rb', line 32

def create_object_uuid
  @uuid_identifier = Identifier::Global::Uuid::Auto.create!(
    by: self.created_by_id,
    project_id: self.project_id,
    identifier_object: self,
    is_generated: true
  )
end

#generate_uuid_if_requiredObject (private)



28
29
30
# File 'app/models/concerns/shared/auto_uuid.rb', line 28

def generate_uuid_if_required
  create_object_uuid if uuid_required && !uuid_identifier
end