Class: Renalware::DeathsController

Inherits:
BaseController show all
Includes:
PresenterHelper, Concerns::Pageable
Defined in:
app/controllers/renalware/deaths_controller.rb

Instance Method Summary collapse

Methods included from PresenterHelper

#present

Methods inherited from BaseController

#patient

Instance Method Details

#editObject



14
15
16
17
# File 'app/controllers/renalware/deaths_controller.rb', line 14

def edit
  authorize patient
  render_edit
end

#indexObject



8
9
10
11
12
# File 'app/controllers/renalware/deaths_controller.rb', line 8

def index
  patients = Patient.dead.page(page).per(per_page)
  authorize patients
  render locals: { patients: present(patients, PatientPresenter) }
end

#updateObject



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

def update
  authorize patient
  if patient.update(death_params)
    redirect_to patient_clinical_profile_path(patient),
      notice: t(".success", model_name: "patient")
  else
    flash.now[:error] = t(".failed", model_name: "patient")
    render_edit
  end
end