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.

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

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.


37
38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/tag_groups_controller.rb', line 37

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


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

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

  respond_to do |format|
    format.html
  end
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.


26
27
28
29
30
31
32
# File 'app/controllers/tag_groups_controller.rb', line 26

def new
  @form_object = TagGroup::FormObject.new

  respond_to do |format|
    format.html
  end
end

#showObject


15
16
17
18
19
20
21
# File 'app/controllers/tag_groups_controller.rb', line 15

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

  respond_to do |format|
    format.html
  end
end

#tag_group_form_object_paramsObject


50
51
52
# File 'app/controllers/tag_groups_controller.rb', line 50

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