Sha256: 7e729f001cbe4dc5517f2f2e570d518200c83ef72aba7a461a679a9604c72dc7
Contents?: true
Size: 1.05 KB
Versions: 12
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true module Renalware class DeathsController < BaseController include PresenterHelper include Renalware::Concerns::Pageable 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 def edit authorize patient render_edit end 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 private def render_edit render :edit, locals: { patient: patient } end def death_params params .require(:patient) .permit(:died_on, :first_cause_id, :second_cause_id, :death_notes) .merge(by: current_user) end end end
Version data entries
12 entries across 12 versions & 1 rubygems