Sha256: 0055380d70e2008961a79e76313dbe17c86f408b43f9df2ed380f515e49de17a

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

module KktShoppe
  class TaxRatesController < KktShoppe::ApplicationController

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

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

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

    def create
      @tax_rate = KktShoppe::TaxRate.new(safe_params)
      if @tax_rate.save
        redirect_to :tax_rates, :flash => {:notice => t('kkt_shoppe.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('kkt_shoppe.tax_rates.update_notice')}
      else
        render :action => "form"
      end
    end

    def destroy
      @tax_rate.destroy
      redirect_to :tax_rates, :flash => {:notice => t('kkt_shoppe.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

9 entries across 9 versions & 1 rubygems

Version Path
kkt_shoppe-2.0.2 app/controllers/kkt_shoppe/tax_rates_controller.rb
kkt_shoppe-2.0.1 app/controllers/kkt_shoppe/tax_rates_controller.rb
kkt_shoppe-2.0.0 app/controllers/kkt_shoppe/tax_rates_controller.rb
kkt_shoppe-1.3.0 app/controllers/kkt_shoppe/tax_rates_controller.rb
kkt_shoppe-1.2.1 app/controllers/kkt_shoppe/tax_rates_controller.rb
kkt_shoppe-1.2.0 app/controllers/kkt_shoppe/tax_rates_controller.rb
kkt_shoppe-1.1.2 app/controllers/kkt_shoppe/tax_rates_controller.rb
kkt_shoppe-1.1.1 app/controllers/kkt_shoppe/tax_rates_controller.rb
kkt_shoppe-1.1.0 app/controllers/kkt_shoppe/tax_rates_controller.rb