Class: RecordLoader::TagGroupLoader
- Inherits:
-
ApplicationRecordLoader
- Object
- Base
- ApplicationRecordLoader
- RecordLoader::TagGroupLoader
- Defined in:
- lib/record_loader/tag_group_loader.rb
Overview
Creates the specified tag groups if they are not present
Instance Method Summary collapse
Methods inherited from ApplicationRecordLoader
Instance Method Details
#create_or_update!(name, options) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/record_loader/tag_group_loader.rb', line 13 def create_or_update!(name, ) = .delete('tags') || [] TagGroup .create_with() .find_or_create_by!(name:) .tap do |tag_group| tag_attributes = .map { |map_id, oligo| { map_id:, oligo: } } tag_group..import(tag_attributes) if tag_group..empty? end end |