Class: ContributionsController

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

Instance Method Summary collapse

Instance Method Details

#createObject


29
30
31
32
33
34
35
# File 'app/controllers/contributions_controller.rb', line 29

def create
  @contribution = Contribution.new(contribution_params)
  authorize @contribution    
  @contribution.save

  respond_with(@contribution)
end

#destroyObject


43
44
45
46
47
# File 'app/controllers/contributions_controller.rb', line 43

def destroy
  @contribution.destroy

  respond_with(@contribution)
end

#editObject


25
26
27
# File 'app/controllers/contributions_controller.rb', line 25

def edit
  @jobs = Contribution.jobs
end

#indexObject


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

def index
  @contributions = policy_scope(Contribution).page(params[:page])
  authorize Contribution

  respond_with(@contributions)
end

#newObject


17
18
19
20
21
22
23
# File 'app/controllers/contributions_controller.rb', line 17

def new
  @jobs = Contribution.jobs
  @contribution = Contribution.new
  authorize @contribution

  respond_with(@contribution)
end

#showObject


13
14
15
# File 'app/controllers/contributions_controller.rb', line 13

def show
  respond_with(@contribution)
end

#updateObject


37
38
39
40
41
# File 'app/controllers/contributions_controller.rb', line 37

def update
  @contribution.update(contribution_params)

  respond_with(@contribution)
end