Class: RecordLoader::DescriptorLoader
- Inherits:
-
ApplicationRecordLoader
- Object
- Base
- ApplicationRecordLoader
- RecordLoader::DescriptorLoader
- Defined in:
- lib/record_loader/descriptor_loader.rb
Overview
Creates the specified Descriptor if they are not present Links the created task to the appropriate task and workflow if they exist. If the workflow or task is not found, it logs a warning and returns nil
in development
, staging
, or cucumber
environments.
Instance Method Summary collapse
Methods inherited from ApplicationRecordLoader
Instance Method Details
#create_or_update!(name, options) ⇒ Object
[View source]
16 17 18 19 20 21 22 23 |
# File 'lib/record_loader/descriptor_loader.rb', line 16 def create_or_update!(name, ) workflow_name = .delete('workflow') workflow = Workflow.find_by!(name: workflow_name) task_name = .delete('task') task = Task.find_by!(name: task_name, pipeline_workflow_id: workflow.id) [:task_id] = task.id Descriptor.create_with().find_or_create_by!(name: name, task_id: task.id) end |