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



18
19
20
21
# File 'app/controllers/renalware/deaths_controller.rb', line 18

def edit
  authorize patient
  render_edit
end

#indexObject



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

def index
  patients = Patient.dead.page(page).per(per_page)
  search = patients.ransack(params[:q])
  authorize patients
  render locals: {
    patients: present(search.result, PatientPresenter),
    q: search
  }
end

#updateObject



23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/renalware/deaths_controller.rb', line 23

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