Class: Renalware::Clinical::BodyCompositionsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Clinical::BodyCompositionsController
- Defined in:
- app/controllers/renalware/clinical/body_compositions_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 25 def create body_composition = build_body_composition if body_composition.save redirect_to patient_clinical_profile_path(patient), notice: t(".success", model_name: "body composition") else flash.now[:error] = t(".failed", model_name: "body composition") render_new(body_composition) end end |
#edit ⇒ Object
36 37 38 39 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 36 def edit body_composition = find_body_composition render locals: { patient: patient, body_composition: body_composition } end |
#new ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 16 def new body_composition = BodyComposition.new( patient: patient, assessor: current_user, assessed_on: Time.zone.today ) render_new(body_composition) end |
#show ⇒ Object
11 12 13 14 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 11 def show body_composition = find_body_composition render locals: { patient: patient, body_composition: body_composition } end |
#update ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 41 def update body_composition = find_body_composition body_composition if body_composition.update(body_composition_params) redirect_to patient_clinical_profile_path(patient), notice: success_msg_for("body_composition") else render :edit, locals: { patient: patient, body_composition: body_composition } end end |