Sha256: b280bbec479389ca2d7c6fd6496c8a1053dc6704a3eead1448b7ab33f2de62ae

Contents?: true

Size: 953 Bytes

Versions: 6

Compression:

Stored size: 953 Bytes

Contents

class Forge::TaxRatesController < ForgeController
  load_and_authorize_resource

  def index
    @tax_rate = TaxRate.new
    respond_to do |format|
      format.html { get_tax_rates }
    end
  end

  def edit
    render :layout => false
  end

  def create
    @tax_rate = TaxRate.new(params[:tax_rate])
    if @tax_rate.save
      flash[:notice] = 'Tax rate was successfully created.'
      redirect_to(forge_tax_rates_path)
    else
      get_tax_rates
      render :action => "index"
    end
  end

  def update
    if @tax_rate.update_attributes(params[:tax_rate])
      flash[:notice] = 'Tax rate was successfully updated.'
      redirect_to(forge_tax_rates_path)
    else
      render :action => "edit"
    end
  end

  def destroy
    @tax_rate.destroy
    redirect_to(forge_tax_rates_path)
  end


  private

    def get_tax_rates
      @tax_rates = TaxRate.by_country_and_province.paginate(:per_page => 10, :page => params[:page])
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge/app/controllers/forge/tax_rates_controller.rb
forge-cli-0.1.9 lib/forge/app/controllers/forge/tax_rates_controller.rb
forge-cli-0.1.8 lib/forge/app/controllers/forge/tax_rates_controller.rb
forge-cli-0.1.7 lib/forge/app/controllers/forge/tax_rates_controller.rb
forge-cli-0.1.6 lib/forge/app/controllers/forge/tax_rates_controller.rb
forge-cli-0.1.5 lib/forge/app/controllers/forge/tax_rates_controller.rb