Class: TagSubstitutionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/tag_substitutions_controller.rb

Overview

The TagSubstitutionsController provides a means of updating tags post library creation. The form is provided with an asset id (through the route) which helps populate the initial form, and allows new tags to be selected

Author:

  • grl

Constant Summary collapse

SUGGESTED_REASONS =

A list of suggested reasons for the drop down.

[
  'Incorrect tags supplied in manifest.',
  'Incorrect tags selected in Sequencescape.',
  'Samples switched at tag application.',
  'Incorrect tags applied by accident.',
  'Tag substituted intentionally, but unsupported by Sequencescape.'
].freeze

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #clean_params_from_check, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Instance Method Details

#createObject


27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/controllers/tag_substitutions_controller.rb', line 27

def create
  @receptacle_id = params[:receptacle_id]
  @tag_substitution = TagSubstitution.new(tag_substitution_params)

  if @tag_substitution.save
    redirect_to receptacle_path(params[:receptacle_id]), notice: 'Your substitution was performed.'
  else
    prepare_form
    flash.now[:error] = 'Your tag substitution could not be performed.'
    render action: :new
  end
end

#newObject


22
23
24
25
# File 'app/controllers/tag_substitutions_controller.rb', line 22

def new
  @receptacle_id = params[:receptacle_id]
  @tag_substitution = TagSubstitution.new(template_asset: Receptacle.find(params[:receptacle_id]))
end