Sha256: ca666598056789144293e442cc2ea52c2be601178a40851c8427e474a2d3c882
Contents?: true
Size: 1.59 KB
Versions: 7
Compression:
Stored size: 1.59 KB
Contents
require_dependency "renalware/hd/base_controller" module Renalware module HD class CannulationTypesController < BaseController before_action :load_cannulation_type, only: [:edit, :update] def new @cannulation_type = CannulationType.new authorize @cannulation_type end def create @cannulation_type = CannulationType.new(cannulation_type_params) authorize @cannulation_type if @cannulation_type.save redirect_to hd_cannulation_types_path, notice: t(".success", model_name: "cannulation type") else flash.now[:error] = t(".failed", model_name: "cannulation type") render :new end end def index @cannulation_types = CannulationType.all authorize @cannulation_types end def update if @cannulation_type.update(cannulation_type_params) redirect_to hd_cannulation_types_path, notice: t(".success", model_name: "cannulation type") else flash.now[:error] = t(".failed", model_name: "cannulation type") render :edit end end def destroy authorize CannulationType.destroy(params[:id]) redirect_to hd_cannulation_types_path, notice: t(".success", model_name: "cannulation type") end private def cannulation_type_params params.require(:hd_cannulation_type).permit(:name) end def load_cannulation_type @cannulation_type = CannulationType.find(params[:id]) authorize @cannulation_type end end end end
Version data entries
7 entries across 7 versions & 1 rubygems