Sha256: 2791bec8a82671d7fb3d8533f50559f5794bc9733145f8c8cb4efdf59d1322a8
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module Renalware class DeathsController < BaseController include PresenterHelper include Pagy::Backend def index query = Patients::DeceasedPatientsQuery.new(params[:q]) pagy, patients = pagy(query.call.includes(previous_modality: :description)) authorize patients render locals: { patients: present(patients, PatientPresenter), q: query.search, pagy: pagy } 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: success_msg_for("patient") else flash.now[:error] = failed_msg_for("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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
renalware-core-2.1.1 | app/controllers/renalware/deaths_controller.rb |
renalware-core-2.1.0 | app/controllers/renalware/deaths_controller.rb |