Class: TagGroupsController

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

Overview

This class is the controller for Tag Groups, which are basically used to record the grouping of a set of Sequencing Tags. It allows you to create and view Tag Groups.

Constant Summary

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods inherited from ApplicationController

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

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#createObject

The create method uses a form object to validate the user input of the oligo sequences and handle the creation of Tags within a new Tag Group.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/tag_groups_controller.rb', line 32

def create
  @form_object = TagGroup::FormObject.new(tag_group_form_object_params)

  respond_to do |format|
    if @form_object.save
      flash[:notice] = 'Tag Group was successfully created.'
      format.html { redirect_to(@form_object.tag_group) }
    else
      format.html { render action: 'new' }
    end
  end
end

#indexObject



8
9
10
11
12
# File 'app/controllers/tag_groups_controller.rb', line 8

def index
  @tag_groups = TagGroup.includes(:adapter_type)

  respond_to { |format| format.html }
end

#newObject

The new method uses a form object to handle the naming of the Tag Group and the input and validation of the Tag oligo sequences.



23
24
25
26
27
# File 'app/controllers/tag_groups_controller.rb', line 23

def new
  @form_object = TagGroup::FormObject.new

  respond_to { |format| format.html }
end

#showObject



14
15
16
17
18
# File 'app/controllers/tag_groups_controller.rb', line 14

def show
  @tag_group = TagGroup.find(params[:id])

  respond_to { |format| format.html }
end

#tag_group_form_object_paramsObject



45
46
47
# File 'app/controllers/tag_groups_controller.rb', line 45

def tag_group_form_object_params
  params.require(:tag_group).permit(:name, :oligos_text, :adapter_type_id)
end