Sha256: 34c70b87195fb98833cc7bb3987a79d3164167385ff7a350f878ada5a734ccc1

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 Bytes

Contents

module Renalware
  class DeathsController < BaseController
    include PresenterHelper
    include Renalware::Concerns::Pageable

    before_action :load_patient, only: [:edit, :update]

    def index
      patients = Patient.dead.page(page).per(per_page)
      authorize patients
      @patients = present(patients, PatientPresenter)
    end

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

    private

    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

1 entries across 1 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta4 app/controllers/renalware/deaths_controller.rb