Class: Renalware::Hospitals::UnitsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- Renalware::Hospitals::UnitsController
- Defined in:
- app/controllers/renalware/hospitals/units_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 |
# File 'app/controllers/renalware/hospitals/units_controller.rb', line 14 def create hospital_unit = Unit.new(hospital_unit_params) hospital_unit if hospital_unit.save redirect_to hospitals_units_path, notice: success_msg_for("hospital unit") else flash.now[:error] = failed_msg_for("hospital unit") render_new(hospital_unit) end end |
#destroy ⇒ Object
46 47 48 49 50 |
# File 'app/controllers/renalware/hospitals/units_controller.rb', line 46 def destroy hospital_unit = hospital_unit.destroy! redirect_to hospitals_units_path, notice: success_msg_for("hospital unit") end |
#edit ⇒ Object
32 33 34 |
# File 'app/controllers/renalware/hospitals/units_controller.rb', line 32 def edit render_edit() end |
#index ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/renalware/hospitals/units_controller.rb', line 26 def index hospital_units = Unit.all hospital_units render locals: { hospital_units: hospital_units } end |
#new ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/renalware/hospitals/units_controller.rb', line 8 def new hospital_unit = Unit.new hospital_unit render_new(hospital_unit) end |
#update ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/renalware/hospitals/units_controller.rb', line 36 def update hospital_unit = if hospital_unit.update(hospital_unit_params) redirect_to hospitals_units_path, notice: success_msg_for("hospital unit") else flash.now[:error] = failed_msg_for("hospital unit") render_edit(hospital_unit) end end |