Class: PixelFire::TagsController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /tags



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

def create
  @tag = Tag.new(tag_params)

  if @tag.save
    @tag.update_triggers(params[:trigger_ids])
    redirect_to @tag, notice: 'Tag was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /tags/1



48
49
50
51
# File 'app/controllers/pixel_fire/tags_controller.rb', line 48

def destroy
  @tag.destroy
  redirect_to tags_url, notice: 'Tag was successfully destroyed.'
end

#editObject

GET /tags/1/edit



22
23
# File 'app/controllers/pixel_fire/tags_controller.rb', line 22

def edit
end

#indexObject

GET /tags



8
9
10
# File 'app/controllers/pixel_fire/tags_controller.rb', line 8

def index
  @tags = Tag.all
end

#newObject

GET /tags/new



17
18
19
# File 'app/controllers/pixel_fire/tags_controller.rb', line 17

def new
  @tag = Tag.new
end

#showObject

GET /tags/1



13
14
# File 'app/controllers/pixel_fire/tags_controller.rb', line 13

def show
end

#updateObject

PATCH/PUT /tags/1



38
39
40
41
42
43
44
45
# File 'app/controllers/pixel_fire/tags_controller.rb', line 38

def update
  if @tag.update(tag_params)
    @tag.update_triggers(params[:trigger_ids])
    redirect_to @tag, notice: 'Tag was successfully updated.'
  else
    render :edit
  end
end