Sha256: a13ca139c9152c5137a08c59c545716d1c230e9d05fb78ad230ab47270724701
Contents?: true
Size: 1.86 KB
Versions: 35
Compression:
Stored size: 1.86 KB
Contents
require_dependency "renalware/hd/base_controller" module Renalware module PD class InfectionOrganismsController < BaseController def index @infectable = infectable_class.find(infectable_id) @infection_organisms = @infectable.infection_organisms authorize @infectable.patient end def new @infectable = infectable_class.find(infectable_id) @infection_organism = InfectionOrganism.new authorize @infectable.patient end def create @infectable = infectable_class.find(infectable_id) authorize @infectable.patient @infection_organism = @infectable.infection_organisms.create(infection_organism_params) end def edit @infection_organism = InfectionOrganism.find(params[:id]) @infectable = @infection_organism.infectable authorize @infectable.patient end def update @infection_organism = InfectionOrganism.find(params[:id]) @infectable = @infection_organism.infectable authorize @infectable.patient @infection_organism.update(infection_organism_params) end def destroy @infection_organism = InfectionOrganism.find(params[:id]) @infectable = @infection_organism.infectable @infection_organisms = @infectable.infection_organisms authorize @infectable.patient @infection_organism.destroy! end private def infection_organism_params params .require(:pd_infection_organism) .permit(:organism_code_id, :sensitivity, :resistance) end def infectable_class @infectable_class ||= infectable_type.singularize.classify.constantize end def infectable_type params.fetch(:infectable_type) end def infectable_id params.fetch(:infectable_id) end end end end
Version data entries
35 entries across 35 versions & 1 rubygems