Sha256: 39cf16e6f96ac6cea350e2bf1244a78a4284f28eb3c099b639a45abccc31fd8e
Contents?: true
Size: 1.57 KB
Versions: 12
Compression:
Stored size: 1.57 KB
Contents
module Spree module Admin module SolidusTecEstimator class ProvidersController < BaseController before_action :set_provider, only: [:edit, :update, :destroy] before_action :set_providers_classes, only: [:new, :edit] def index @providers = ::SolidusTecEstimator::Provider.all end def new @provider = ::SolidusTecEstimator::Provider.new end def edit end def create provider = ::SolidusTecEstimator::Provider.new provider_params if provider.save flash[:success] = "Provider criado com sucesso" redirect_to admin_solidus_tec_estimator_providers_path else flash[:error] = provider.errors.full_messages.join("\n") redirect_to new_admin_solidus_tec_estimator_provider_path end end def update @provider.update provider_params redirect_to admin_solidus_tec_estimator_providers_path end def destroy @provider.delete flash[:success] = "Provider excluĂdo" redirect_to admin_solidus_tec_estimator_providers_path end private def set_provider @provider = ::SolidusTecEstimator::Provider.find_by(id: params[:id]) end def set_providers_classes @providers_classes = ::SolidusTecEstimator.config.providers_classes || [] end def provider_params params.required(:provider).permit(:name, :class_name, :active) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems