Class: Renalware::Clinical::BodyCompositionsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Clinical::BodyCompositionsController
- Includes:
- Renalware::Concerns::Pageable
- 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
31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 31 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
42 43 44 45 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 42 def edit body_composition = find_body_composition render locals: { patient: patient, body_composition: body_composition } end |
#index ⇒ Object
12 13 14 15 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 12 def index body_compositions = BodyComposition.for_patient(patient).ordered.page(page).per(per_page) render locals: { patient: patient, body_compositions: body_compositions } end |
#new ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 22 def new body_composition = BodyComposition.new( patient: patient, assessor: current_user, assessed_on: Time.zone.today ) render_new(body_composition) end |
#show ⇒ Object
17 18 19 20 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 17 def show body_composition = find_body_composition render locals: { patient: patient, body_composition: body_composition } end |
#update ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/renalware/clinical/body_compositions_controller.rb', line 47 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 |