Class: Munificent::Admin::CharitiesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
16
17
18
19
# File 'app/controllers/munificent/admin/charities_controller.rb', line 11

def create
  if @charity.save
    flash[:notice] = "Charity created"
    redirect_to edit_charity_path(@charity)
  else
    flash[:alert] = @charity.errors.full_messages.join(", ")
    redirect_to new_charity_path
  end
end

#destroyObject



34
35
36
37
# File 'app/controllers/munificent/admin/charities_controller.rb', line 34

def destroy
  @charity.destroy
  redirect_to charities_path
end

#editObject



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

def edit; end

#indexObject



6
# File 'app/controllers/munificent/admin/charities_controller.rb', line 6

def index; end

#newObject



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

def new; end

#showObject



7
# File 'app/controllers/munificent/admin/charities_controller.rb', line 7

def show; end

#updateObject



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

def update
  @charity.assign_attributes(charity_params)
  @charity.charity_tiers = @charity.charity_tiers.compact_blank

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

  redirect_to edit_charity_path(@charity)
end