Class: Renalware::Transplants::DonorStagesController

Inherits:
BaseController show all
Defined in:
app/controllers/renalware/transplants/donor_stages_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Methods inherited from BaseController

#patient

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/renalware/transplants/donor_stages_controller.rb', line 18

def create
  authorize donor_stage
  result = CreateDonorStage.new(patient: patient, options: donor_stage_params).call
  if result.success?
    redirect_to patient_transplants_donor_dashboard_path(patient),
                notice: t(".success", model_name: "donor stage")
  else
    render :new, locals: {
      patient: patient,
      stage: result.object
    }
  end
end

#newObject



9
10
11
12
13
14
15
16
# File 'app/controllers/renalware/transplants/donor_stages_controller.rb', line 9

def new
  stage = DonorStage.new(patient: patient)
  authorize stage
  render locals: {
    patient: patient,
    stage: stage
  }
end