Class: RecordLoader::PipelineRequestInformationTypeLoader

Inherits:
ApplicationRecordLoader show all
Defined in:
lib/record_loader/pipeline_request_information_type_loader.rb

Overview

Creates the specified pipeline request information types if they are not present. It requires an existing pipeline name and an existing request information type

Instance Method Summary collapse

Methods inherited from ApplicationRecordLoader

#wip_list

Instance Method Details

#create_or_update!(_name, options) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/record_loader/pipeline_request_information_type_loader.rb', line 13

def create_or_update!(_name, options)
  pipeline = Pipeline.find_by!(name: options['pipeline_name'])
  request_information_type = RequestInformationType.find_by!(key: options['request_information_type_key'])
  PipelineRequestInformationType.create_with(pipeline:, request_information_type:).find_or_create_by!(
    pipeline:,
    request_information_type:
  )
end