Sha256: 875e280b280cba0b2f6545121f5bd7466db19917616dbd4c1d8a33a6a3b47fb1

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

module Tienda
  class TaxRatesController < Tienda::ApplicationController

    before_filter { @active_nav = :tax_rates }
    before_filter { params[:id] && @tax_rate = Tienda::TaxRate.find(params[:id]) }

    def index
      @tax_rates = Tienda::TaxRate.ordered.all
    end

    def new
      @tax_rate = Tienda::TaxRate.new
      render action: "form"
    end

    def create
      @tax_rate = Tienda::TaxRate.new(safe_params)
      if @tax_rate.save
        redirect_to :tax_rates, flash: { notice: t('tienda.tax_rates.create_notice') }
      else
        render action: "form"
      end
    end

    def edit
      render action: "form"
    end

    def update
      if @tax_rate.update(safe_params)
        redirect_to [:edit, @tax_rate], flash: { notice: t('tienda.tax_rates.update_notice') }
      else
        render action: "form"
      end
    end

    def destroy
      @tax_rate.destroy
      redirect_to :tax_rates, flash: { notice: t('tienda.tax_rates.destroy_notice') }
    end

    private

    def safe_params
      params[:tax_rate].permit(:name, :rate, :address_type, country_ids: [])
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tienda-2.1.3 app/controllers/tienda/tax_rates_controller.rb
tienda-2.1.2 app/controllers/tienda/tax_rates_controller.rb
tienda-2.1.1 app/controllers/tienda/tax_rates_controller.rb
tienda-2.1.0 app/controllers/tienda/tax_rates_controller.rb
tienda-2.0.2 app/controllers/tienda/tax_rates_controller.rb
tienda-2.0.1 app/controllers/tienda/tax_rates_controller.rb
tienda-1.1.2 app/controllers/tienda/tax_rates_controller.rb
tienda-1.1.1 app/controllers/tienda/tax_rates_controller.rb
tienda-1.1.0 app/controllers/tienda/tax_rates_controller.rb
tienda-1.0.0 app/controllers/tienda/tax_rates_controller.rb