Class: PrizesController

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

Instance Method Summary collapse

Instance Method Details

#createObject


26
27
28
29
30
31
32
# File 'app/controllers/prizes_controller.rb', line 26

def create
  @prize = Prize.new(prize_params)
  authorize @prize
  @prize.save

  respond_with(@prize)
end

#destroyObject


40
41
42
43
44
# File 'app/controllers/prizes_controller.rb', line 40

def destroy
  @prize.destroy

  respond_with(@prize)
end

#editObject


23
24
# File 'app/controllers/prizes_controller.rb', line 23

def edit
end

#indexObject


6
7
8
9
10
# File 'app/controllers/prizes_controller.rb', line 6

def index
  @prizes = policy_scope(Prize).page(params[:page])

  respond_with(@prizes)
end

#newObject


16
17
18
19
20
21
# File 'app/controllers/prizes_controller.rb', line 16

def new
  @prize = Prize.new
  authorize @prize

  respond_with(@prize)
end

#showObject


12
13
14
# File 'app/controllers/prizes_controller.rb', line 12

def show
  respond_with(@prize)
end

#updateObject


34
35
36
37
38
# File 'app/controllers/prizes_controller.rb', line 34

def update
  @prize.update(prize_params)

  respond_with(@prize)
end