Sha256: a88609ea8b04f36d192b5ad9cdf79ff65c5ee5712de76ed48cb8c2983be75d5f

Contents?: true

Size: 1.02 KB

Versions: 27

Compression:

Stored size: 1.02 KB

Contents

require_dependency "renalware/clinical"

module Renalware
  module Clinical
    class AllergiesController < Clinical::BaseController
      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

      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

      private

      def allergy_params
        params.require(:clinical_allergy).permit([:description])
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
renalware-core-2.0.16 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.15 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.14 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.13 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.12 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.11 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.9 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.8 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.7 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.5 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.4 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.3 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.2 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.1 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.0 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.0.pre.rc13 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.0.pre.rc11 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.0.pre.rc10 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.0.pre.rc9 app/controllers/renalware/clinical/allergies_controller.rb
renalware-core-2.0.0.pre.rc8 app/controllers/renalware/clinical/allergies_controller.rb