Class: PlaybooksController

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

Overview

Restful controller for Playbooks

Instance Method Summary collapse

Methods inherited from ApplicationController

#check_for_mobile, #mobile_device?

Instance Method Details

#createObject

POST /playbooks POST /playbooks.json


28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/playbooks_controller.rb', line 28

def create
  @playbook = Playbook.new(playbook_params)
  authorize @playbook
  respond_to do |format|
    if @playbook.save
      format.html { redirect_to @playbook, notice: t('.success') }
      format.json { render :show, status: :created, location: @playbook }
    else
      format.html { render :new }
      format.json { render json: @playbook.errors, status: :unprocessable_entity }
    end
  end
end

#destroyObject

DELETE /playbooks/1 DELETE /playbooks/1.json


58
59
60
61
62
63
64
# File 'app/controllers/playbooks_controller.rb', line 58

def destroy
  @playbook.destroy
  respond_to do |format|
    format.html { redirect_to playbooks_url, notice: t('.success') }
    format.json { head :no_content }
  end
end

#editObject

GET /playbooks/1/edit


24
# File 'app/controllers/playbooks_controller.rb', line 24

def edit() end

#indexObject

GET /playbooks GET /playbooks.json


9
10
11
# File 'app/controllers/playbooks_controller.rb', line 9

def index
  @playbooks = policy_scope(Playbook)
end

#newObject

GET /playbooks/new


18
19
20
21
# File 'app/controllers/playbooks_controller.rb', line 18

def new
  @playbook = Playbook.new
  authorize @playbook
end

#showObject

GET /playbooks/1 GET /playbooks/1.json


15
# File 'app/controllers/playbooks_controller.rb', line 15

def show() end

#updateObject

PATCH/PUT /playbooks/1 PATCH/PUT /playbooks/1.json


44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/playbooks_controller.rb', line 44

def update
  respond_to do |format|
    if @playbook.update(playbook_params)
      format.html { redirect_to @playbook, notice: t('.success') }
      format.json { render :show, status: :ok, location: @playbook }
    else
      format.html { render :edit }
      format.json { render json: @playbook.errors, status: :unprocessable_entity }
    end
  end
end