Class: Renalware::Clinical::AllergiesController

Inherits:
BaseController show all
Defined in:
app/controllers/renalware/clinical/allergies_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Methods inherited from BaseController

#patient

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/renalware/clinical/allergies_controller.rb', line 8

def create
  result = CreateAllergy.new(patient, current_user).call(allergy_params) do |allergy|
    authorize allergy
  end
  if result.success?
    redirect_back fallback_location: patient_clinical_profile_path(patient),
                  notice: success_msg_for("allergy")

  else
    # we use client-side validation so will not get here
    raise NotImplementedError
  end
end

#destroyObject



22
23
24
25
26
27
28
# File 'app/controllers/renalware/clinical/allergies_controller.rb', line 22

def destroy
  allergy = patient.allergies.find(params[:id])
  authorize allergy
  DeleteAllergy.new(allergy, current_user).call
  redirect_back fallback_location: patient_clinical_profile_path(patient),
                notice: t(".success_with_name", name: allergy.description)
end