Class: CustomMetadatumCollection

Inherits:
ApplicationRecord show all
Includes:
Uuid::Uuidable
Defined in:
app/models/custom_metadatum_collection.rb

Instance Method Summary collapse

Methods included from Uuid::Uuidable

included, #unsaved_uuid!, #uuid

Methods inherited from ApplicationRecord

convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Warren::BroadcastMessages

#broadcast, included, #queue_associated_for_broadcast, #queue_for_broadcast, #warren

Instance Method Details

#metadataObject


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

def 
  .collect(&:to_h).inject(:merge!) || {}
end

#metadata=(attributes) ⇒ Object


14
15
16
17
18
19
# File 'app/models/custom_metadatum_collection.rb', line 14

def metadata=(attributes)
  ActiveRecord::Base.transaction do
    .clear
    attributes.map { |k, v| .build(key: k, value: v) }
  end
end