Class: Munificent::Admin::CharitiesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Munificent::Admin::CharitiesController
- Defined in:
- app/controllers/munificent/admin/charities_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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..join(", ") redirect_to new_charity_path end end |
#destroy ⇒ Object
34 35 36 37 |
# File 'app/controllers/munificent/admin/charities_controller.rb', line 34 def destroy @charity.destroy redirect_to charities_path end |
#edit ⇒ Object
9 |
# File 'app/controllers/munificent/admin/charities_controller.rb', line 9 def edit; end |
#index ⇒ Object
6 |
# File 'app/controllers/munificent/admin/charities_controller.rb', line 6 def index; end |
#new ⇒ Object
8 |
# File 'app/controllers/munificent/admin/charities_controller.rb', line 8 def new; end |
#show ⇒ Object
7 |
# File 'app/controllers/munificent/admin/charities_controller.rb', line 7 def show; end |
#update ⇒ Object
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..join(", ") end redirect_to edit_charity_path(@charity) end |