Class: Munificent::Admin::BundlesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Munificent::Admin::BundlesController
- Defined in:
- app/controllers/munificent/admin/bundles_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
22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/munificent/admin/bundles_controller.rb', line 22 def create if @bundle.save flash[:notice] = "Bundle created" redirect_to edit_bundle_path(@bundle) else flash[:alert] = @bundle.errors..join(", ") redirect_to new_bundle_path end end |
#destroy ⇒ Object
45 46 47 48 |
# File 'app/controllers/munificent/admin/bundles_controller.rb', line 45 def destroy @bundle.destroy redirect_to bundles_path end |
#edit ⇒ Object
16 17 18 19 20 |
# File 'app/controllers/munificent/admin/bundles_controller.rb', line 16 def edit @bundle.bundle_tiers.build( price_currency: @bundle.fundraiser.main_currency, ) end |
#index ⇒ Object
9 |
# File 'app/controllers/munificent/admin/bundles_controller.rb', line 9 def index; end |
#new ⇒ Object
12 13 14 |
# File 'app/controllers/munificent/admin/bundles_controller.rb', line 12 def new @bundle.bundle_tiers.build end |
#show ⇒ Object
10 |
# File 'app/controllers/munificent/admin/bundles_controller.rb', line 10 def show; end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/controllers/munificent/admin/bundles_controller.rb', line 32 def update @bundle.assign_attributes(bundle_params) @bundle.bundle_tiers = @bundle.bundle_tiers.compact_blank if @bundle.save flash[:notice] = "Bundle saved" else flash[:alert] = @bundle.errors..join(", ") end redirect_to edit_bundle_path(@bundle) end |