Class: Renalware::PD::PETAdequacyResultsController

Inherits:
BaseController show all
Includes:
PresenterHelper
Defined in:
app/controllers/renalware/pd/pet_adequacy_results_controller.rb

Instance Method Summary collapse

Methods included from PresenterHelper

#present

Methods inherited from BaseController

#patient

Instance Method Details

#createObject

rubocop:disable Metrics/AbcSize



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/renalware/pd/pet_adequacy_results_controller.rb', line 18

def create
  result = patient.pet_adequacy_results.new(pet_adequacy_result_params)
  authorize result
  if result.save
    redirect_to patient_pd_dashboard_path(patient), notice: success_msg_for("PET Adequacy")
  else
    flash.now[:error] = failed_msg_for("PET Adequacy")
    render :new, locals: { pet_adequacy_result: result, patient: patient }
  end
end

#editObject

rubocop:enable Metrics/AbcSize



30
31
32
# File 'app/controllers/renalware/pd/pet_adequacy_results_controller.rb', line 30

def edit
  render locals: { pet_adequacy_result: pet_adequacy_result, patient: patient }
end

#newObject



11
12
13
14
15
# File 'app/controllers/renalware/pd/pet_adequacy_results_controller.rb', line 11

def new
  result = patient.pet_adequacy_results.new
  authorize result
  render locals: { pet_adequacy_result: result, patient: patient }
end

#showObject

rubocop:enable Metrics/AbcSize



46
47
48
# File 'app/controllers/renalware/pd/pet_adequacy_results_controller.rb', line 46

def show
  render locals: { pet_adequacy_result: pet_adequacy_result, patient: patient }
end

#updateObject

rubocop:disable Metrics/AbcSize



35
36
37
38
39
40
41
42
43
# File 'app/controllers/renalware/pd/pet_adequacy_results_controller.rb', line 35

def update
  pet_adequacy_result.assign_attributes(pet_adequacy_result_params)
  if pet_adequacy_result.save
    redirect_to patient_pd_dashboard_path(patient), notice: success_msg_for("PET Adequacy")
  else
    flash.now[:error] = failed_msg_for("PET Adequacy")
    render :edit, locals: { pet_adequacy_result: pet_adequacy_result, patient: patient }
  end
end