Sha256: 2c46a0ada581a054db5c56c91dc886da207e98b50825e23cec85b97d81349ad1

Contents?: true

Size: 829 Bytes

Versions: 7

Compression:

Stored size: 829 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.now[: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

7 entries across 7 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.beta11 app/controllers/renalware/deaths_controller.rb
renalware-core-2.0.0.pre.beta10 app/controllers/renalware/deaths_controller.rb
renalware-core-2.0.0.pre.beta9 app/controllers/renalware/deaths_controller.rb
renalware-core-2.0.0.pre.beta8 app/controllers/renalware/deaths_controller.rb
renalware-core-2.0.0.pre.beta7 app/controllers/renalware/deaths_controller.rb
renalware-core-2.0.0.pre.beta6 app/controllers/renalware/deaths_controller.rb
renalware-core-2.0.0.pre.beta5 app/controllers/renalware/deaths_controller.rb