Module: Tasks::AssignTagsToTubesHandler

Included in:
WorkflowsController
Defined in:
app/models/tasks/assign_tags_to_tubes_handler.rb

Overview

Handles the behaviour of AssignTagsToTubesTask and included in WorkflowsController A Task used in library creation pipelines Applies the selected tags to the library tubes.

Instance Method Summary collapse

Instance Method Details

#do_assign_tags_to_destination_task(_task, params) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/models/tasks/assign_tags_to_tubes_handler.rb', line 4

def do_assign_tags_to_destination_task(_task, params)
  @tag_group = TagGroup.find(params[:tag_group])

  ActiveRecord::Base.transaction do
    @batch.requests.each do |request|
      tag_id = params[:tag][request.id.to_s] or next
      tag    = @tag_group.tags.find(tag_id)
      tag.tag!(request.target_asset)
    end
  end

  true
end