Class: Munificent::Admin::FundraisersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/munificent/admin/fundraisers_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/munificent/admin/fundraisers_controller.rb', line 13

def create
  if @fundraiser.save
    flash[:notice] = "Fundraiser created"
    redirect_to edit_fundraiser_path(@fundraiser)
  else
    flash[:alert] = @fundraiser.errors.full_messages.join(", ")
    redirect_to new_fundraiser_path
  end
end

#destroyObject



35
36
37
38
# File 'app/controllers/munificent/admin/fundraisers_controller.rb', line 35

def destroy
  @fundraiser.destroy
  redirect_to fundraisers_path
end

#editObject



11
# File 'app/controllers/munificent/admin/fundraisers_controller.rb', line 11

def edit; end

#indexObject



8
# File 'app/controllers/munificent/admin/fundraisers_controller.rb', line 8

def index; end

#newObject



10
# File 'app/controllers/munificent/admin/fundraisers_controller.rb', line 10

def new; end

#showObject



9
# File 'app/controllers/munificent/admin/fundraisers_controller.rb', line 9

def show; end

#updateObject



23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/munificent/admin/fundraisers_controller.rb', line 23

def update
  @fundraiser.assign_attributes(fundraiser_params)

  if @fundraiser.save
    flash[:notice] = "Fundraiser saved"
  else
    flash[:alert] = @fundraiser.errors.full_messages.join(", ")
  end

  redirect_to edit_fundraiser_path(@fundraiser)
end