Class: Renalware::PD::BagTypesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::PD::BagTypesController
- Defined in:
- app/controllers/renalware/pd/bag_types_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/renalware/pd/bag_types_controller.rb', line 14 def create bag_type = BagType.new(bag_type_params) bag_type if bag_type.save redirect_to pd_bag_types_path, notice: t(".success", model_name: "bag type") else flash.now[:error] = t(".failed", model_name: "bag type") render :new, locals: { bag_type: bag_type } end end |
#destroy ⇒ Object
48 49 50 51 52 |
# File 'app/controllers/renalware/pd/bag_types_controller.rb', line 48 def destroy bag_type = bag_type.destroy! redirect_to pd_bag_types_path, notice: t(".success", model_name: "bag type") end |
#edit ⇒ Object
33 34 35 |
# File 'app/controllers/renalware/pd/bag_types_controller.rb', line 33 def edit render locals: { bag_type: } end |
#index ⇒ Object
27 28 29 30 31 |
# File 'app/controllers/renalware/pd/bag_types_controller.rb', line 27 def index bag_types = BagType.ordered bag_types render locals: { bag_types: bag_types } end |
#new ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/renalware/pd/bag_types_controller.rb', line 8 def new bag_type = BagType.new bag_type render locals: { bag_type: bag_type } end |
#update ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/renalware/pd/bag_types_controller.rb', line 37 def update bag_type = if bag_type.update(bag_type_params) redirect_to pd_bag_types_path, notice: t(".success", model_name: "bag type") else flash.now[:error] = t(".failed", model_name: "bag type") render :edit, locals: { bag_type: bag_type } end end |