Class: Wco::OfficeActionsController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#home, #tinymce

Methods included from ApplicationHelper

#my_truthy?, #obfuscate, #pp_amount, #pp_currency, #pp_date, #pp_datetime, #pp_money, #pp_percent, #pp_time, #pretty_date

Instance Method Details

#createObject



6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/wco/office_actions_controller.rb', line 6

def create
  @oa = OA.new params[:oa].permit!
  authorize! :update, @oa

  if @oa.save
    flash_notice @oa
  else
    flash_alert @oa
  end
  redirect_to action: :index
end

#destroyObject



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/wco/office_actions_controller.rb', line 18

def destroy
  @oa = OA.find params[:id]
  authorize! :destroy, @oa
  if @oa.delete
    flash_notice @oa
  else
    flash_alert @oa
  end
  redirect_to action: :index
end

#editObject



29
30
31
32
# File 'app/controllers/wco/office_actions_controller.rb', line 29

def edit
  @oa = OA.find params[:id]
  authorize! :edit, @oa
end

#indexObject



34
35
36
37
# File 'app/controllers/wco/office_actions_controller.rb', line 34

def index
  authorize! :index, OA
  @oas = OA.all
end

#newObject



39
40
41
42
# File 'app/controllers/wco/office_actions_controller.rb', line 39

def new
  @oa = OA.new
  authorize! :new, @oa
end

#showObject



44
45
46
47
# File 'app/controllers/wco/office_actions_controller.rb', line 44

def show
  @oa = OA.find params[:id]
  authorize! :show, @oa
end

#updateObject



49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/wco/office_actions_controller.rb', line 49

def update
  @oa = OA.find params[:id]
  authorize! :update, @oa

  if @oa.update params[:oa].permit!
    flash_notice @oa
  else
    flash_alert @oa
  end
  redirect_to action: :index
end