Sha256: 04fa081ce561f84699a52a5e54c605bc33c594d5f65d26c430b35848d581fbe3

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

module Shoppe
  class TaxRatesController < Shoppe::ApplicationController

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

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

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

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

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

11 entries across 11 versions & 3 rubygems

Version Path
shoppe-1.1.2 app/controllers/shoppe/tax_rates_controller.rb
shoppe-1.1.1 app/controllers/shoppe/tax_rates_controller.rb
shoppe-1.1.0 app/controllers/shoppe/tax_rates_controller.rb
shoppe-1.0.9 app/controllers/shoppe/tax_rates_controller.rb
shoppe-1.0.8 app/controllers/shoppe/tax_rates_controller.rb
kylekthompson-shoppe-1.0.7 app/controllers/shoppe/tax_rates_controller.rb
shoppe-1.0.7 app/controllers/shoppe/tax_rates_controller.rb
shoppe-1.0.6 app/controllers/shoppe/tax_rates_controller.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/shoppe-1.0.5/app/controllers/shoppe/tax_rates_controller.rb
shoppe-1.0.5 app/controllers/shoppe/tax_rates_controller.rb
shoppe-1.0.3 app/controllers/shoppe/tax_rates_controller.rb