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

alias_association, convert_labware_to_receptacle_for, find_by_id_or_name, find_by_id_or_name!

Methods included from Squishify

extended

Instance Method Details

#metadataObject



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

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

#metadata=(attributes) ⇒ Object



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

def metadata=(attributes)
  ActiveRecord::Base.transaction do
    .clear

    attributes.each { |k, v| .build(key: k, value: v) }
  end
end