Class: Renalware::Transplants::DonorWorkupsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Transplants::DonorWorkupsController
- Defined in:
- app/controllers/renalware/transplants/donor_workups_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods inherited from BaseController
Instance Method Details
#edit ⇒ Object
19 20 21 22 |
# File 'app/controllers/renalware/transplants/donor_workups_controller.rb', line 19 def edit workup = DonorWorkup.for_patient(patient).first_or_initialize render locals: { patient: patient, workup: workup } end |
#show ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/renalware/transplants/donor_workups_controller.rb', line 10 def show workup = DonorWorkup.for_patient(patient).first_or_initialize if workup.new_record? redirect_to edit_patient_transplants_donor_workup_path(patient) else render locals: { patient: patient, workup: workup } end end |
#update ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/renalware/transplants/donor_workups_controller.rb', line 24 def update workup = DonorWorkup.for_patient(patient).first_or_initialize if workup.update(workup_params) redirect_to patient_transplants_donor_workup_path(patient), notice: t(".success", model_name: "donor work up") else flash.now[:error] = t(".failed", model_name: "donor work up") render :edit, locals: { patient: patient, workup: workup } end end |