Sha256: 751a5b9b82c9fd24e6fe49b27f174fbee146834c16a75b379451ff9f797ce424
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 KB
Contents
# frozen_string_literal: true module Renalware module Accesses class ProceduresController < Accesses::BaseController before_action :load_patient def show procedure = patient.procedures.find(params[:id]) presenter = ProcedurePresenter.new(procedure) render locals: { patient: patient, procedure: presenter } end def new procedure = patient.procedures.new(by: current_user) render locals: { patient: patient, procedure: procedure } end def create procedure = patient.procedures.new(procedure_params) if procedure.save redirect_to patient_accesses_dashboard_path(patient), notice: success_msg_for("Access procedure") else flash.now[:error] = failed_msg_for("Access procedure") render :new, locals: { patient: patient, procedure: procedure } end end def edit procedure = find_procedure render locals: { patient: patient, procedure: procedure } end def update procedure = find_procedure if procedure.update(procedure_params) redirect_to patient_accesses_dashboard_path(patient), notice: success_msg_for("access procedure") else flash.now[:error] = failed_msg_for("access procedure") render :edit, locals: { patient: patient, procedure: procedure } end end protected def find_procedure patient.procedures.find(params[:id]) end def procedure_params params .require(:accesses_procedure) .permit(attributes) .merge(by: current_user) end def attributes [ :performed_on, :first_used_on, :failed_on, :side, :type_id, :catheter_make, :catheter_lot_no, :performed_by, :notes, :outcome, :pd_catheter_insertion_technique_id ] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
renalware-core-2.1.1 | app/controllers/renalware/accesses/procedures_controller.rb |
renalware-core-2.1.0 | app/controllers/renalware/accesses/procedures_controller.rb |