Class: Renalware::Transplants::RecipientWorkupsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Transplants::RecipientWorkupsController
- Defined in:
- app/controllers/renalware/transplants/recipient_workups_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods inherited from BaseController
Instance Method Details
#edit ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/controllers/renalware/transplants/recipient_workups_controller.rb', line 20 def edit workup = RecipientWorkup.for_patient(patient).first_or_initialize workup = RecipientWorkupBuilder.new( workup: workup, default_consenter_name: current_user.to_s ).build render locals: { patient: patient, workup: workup } end |
#show ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/renalware/transplants/recipient_workups_controller.rb', line 10 def show workup = RecipientWorkup.for_patient(patient).first_or_initialize if workup.new_record? redirect_to edit_patient_transplants_recipient_workup_path(patient) else render locals: { patient: patient, workup: workup } end end |
#update ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/renalware/transplants/recipient_workups_controller.rb', line 29 def update workup = RecipientWorkup.for_patient(patient).first_or_initialize if workup.update workup_params redirect_to patient_transplants_recipient_workup_path(patient), notice: t(".success", model_name: "recipient work up") else flash.now[:error] = t(".failed", model_name: "recipient work up") render :edit, locals: { patient: patient, workup: workup } end end |