Class: AwardsController

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

Instance Method Summary collapse

Instance Method Details

#createObject


20
21
22
23
24
25
26
# File 'app/controllers/awards_controller.rb', line 20

def create
  @award = @awardable.awards.new(award_params)
  authorize @award
  
  flash[:notice] = "Award created successfully!" if @award.save
  respond_with(@awardable)
end

#destroyObject


33
34
35
36
# File 'app/controllers/awards_controller.rb', line 33

def destroy
  flash[:notice] = "Award deleted successfully!" if @award.destroy
  respond_with(@awardable)
end

#editObject


17
18
# File 'app/controllers/awards_controller.rb', line 17

def edit    
end

#indexObject


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

def index
  @awards = policy_scope(Award).page(params[:page])
  respond_with(@awards)
end

#showObject


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

def show
  respond_with(@award)
end

#updateObject


28
29
30
31
# File 'app/controllers/awards_controller.rb', line 28

def update
  flash[:notice] = "Award updated successfully!" if @award.update(award_params)
  respond_with(@awardable)
end