Class: PixelFire::TriggersController

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

Instance Method Summary collapse

Instance Method Details

#createObject

POST /triggers



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

def create
  @trigger = Trigger.new(trigger_params)

  if @trigger.save
    @trigger.update_tags(params[:tag_ids])
    redirect_to @trigger, notice: 'Trigger was successfully created.'
  else
    render :new
  end
end

#destroyObject

DELETE /triggers/1



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

def destroy
  @trigger.destroy
  redirect_to triggers_url, notice: 'Trigger was successfully destroyed.'
end

#editObject

GET /triggers/1/edit



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

def edit
end

#indexObject

GET /triggers



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

def index
  @triggers = Trigger.all
end

#newObject

GET /triggers/new



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

def new
  @trigger = Trigger.new
end

#showObject

GET /triggers/1



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

def show
end

#updateObject

PATCH/PUT /triggers/1



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

def update
  if @trigger.update(trigger_params)
    @trigger.update_tags(params[:tag_ids])
    redirect_to @trigger, notice: 'Trigger was successfully updated.'
  else
    render :edit
  end
end