Class: Event::SampleMetadataEvent

Inherits:
Event show all
Defined in:
app/models/event/sample_metadata_event.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

#request, #request?

Methods included from RequestDescriptorUpdateEvent

included, #library_creation_descriptor?, #pass_or_fail_event?, #set_request_metadata, #update_metadata_for_request

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods inherited from ApplicationRecord

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Class Method Details

.updated_sample_metadata!(sample, attribute_changes, user) ⇒ Object

Indicates that the metadata associated with a sample has been updated. Usage example: sample.events.updated_sample_metadata!(attribute_changes, user)



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/models/event/sample_metadata_event.rb', line 6

def self.updated_sample_metadata!(sample, attribute_changes, user)
  return if attribute_changes.empty?

  message = 'Updated sample metadata'
  content = attribute_changes.to_json

  create!(
    eventful: sample,
    message: message,
    content: content,
    family: 'sample_metadata',
    of_interest_to: 'administrators',
    created_by: user&.
  )
end

Instance Method Details

#to_partial_pathObject



22
23
24
# File 'app/models/event/sample_metadata_event.rb', line 22

def to_partial_path
  'events/diff_event'
end