Class: Renalware::Transplants::DonorOperationsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::Transplants::DonorOperationsController
- Defined in:
- app/controllers/renalware/transplants/donor_operations_controller.rb
Instance Method Summary collapse
Methods inherited from BaseController
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/renalware/transplants/donor_operations_controller.rb', line 19 def create operation = DonorOperation.new(patient: patient) operation.attributes = operation_params if operation.save redirect_to patient_transplants_donor_dashboard_path(patient), notice: t(".success", model_name: "donor operation") else flash.now[:error] = t(".failed", model_name: "donor operation") render :new, locals: { operation: operation, patient: patient } end end |
#edit ⇒ Object
32 33 34 35 |
# File 'app/controllers/renalware/transplants/donor_operations_controller.rb', line 32 def edit operation = DonorOperation.for_patient(patient).find(params[:id]) render locals: { operation: operation, patient: patient } end |
#new ⇒ Object
15 16 17 |
# File 'app/controllers/renalware/transplants/donor_operations_controller.rb', line 15 def new render locals: { operation: DonorOperation.new, patient: patient } end |
#show ⇒ Object
10 11 12 13 |
# File 'app/controllers/renalware/transplants/donor_operations_controller.rb', line 10 def show operation = DonorOperation.for_patient(patient).find(params[:id]) render locals: { operation: operation, patient: patient } end |
#update ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/renalware/transplants/donor_operations_controller.rb', line 37 def update operation = DonorOperation.for_patient(patient).find(params[:id]) operation.attributes = operation_params if operation.save redirect_to patient_transplants_donor_dashboard_path(patient), notice: t(".success", model_name: "donor operation") else flash.now[:error] = t(".failed", model_name: "donor operation") render :edit, locals: { operation: operation, patient: patient } end end |