Class: TagSetsController

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

Overview

This class is the controller for Tag Sets which are used to link together two related tag groups. It allows you to create and view Tag Sets.

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



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

def create
  @tag_set = TagSet.new(tag_set_params)

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

#indexObject



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

def index
  @tag_sets = TagSet.all

  respond_to { |format| format.html }
end

#newObject



20
21
22
23
24
# File 'app/controllers/tag_sets_controller.rb', line 20

def new
  @tag_set = TagSet.new

  respond_to { |format| format.html }
end

#showObject



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

def show
  @tag_set = TagSet.find(params[:id])

  respond_to { |format| format.html }
end

#tag_set_paramsObject



39
40
41
# File 'app/controllers/tag_sets_controller.rb', line 39

def tag_set_params
  params.require(:tag_set).permit(:name, :tag_group_id, :tag2_group_id)
end