Sha256: 278a5470623bc4536194ec7cc2b58c2b0e3ea8048902d3362bfb94a2a97a8e0a
Contents?: true
Size: 1.18 KB
Versions: 85
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true require_dependency "renalware/hd/base_controller" module Renalware module HD class PreferenceSetsController < BaseController before_action :load_patient def edit preference_set = PreferenceSet.for_patient(patient).first_or_initialize render locals: { patient: patient, preference_set: preference_set } end def update preference_set = PreferenceSet.for_patient(patient).first_or_initialize if preference_set.update(preference_set_params) redirect_to patient_hd_dashboard_path(patient), notice: t(".success", model_name: "HD preferences") else flash.now[:error] = t(".failed", model_name: "HD preferences") render :edit, locals: { patient: patient, preference_set: preference_set } end end private def attributes [ :schedule_definition_id, :other_schedule, :hospital_unit_id, :entered_on, :notes ] end def preference_set_params params .require(:hd_preference_set) .permit(attributes) .merge(by: current_user) end end end end
Version data entries
85 entries across 85 versions & 1 rubygems