Sha256: 2966171f9f348a23a052cbfc2c87dd68b7e1d39b6f2d82010c00fd292f4a70d9
Contents?: true
Size: 1.16 KB
Versions: 8
Compression:
Stored size: 1.16 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 => "Tax rate has been created successfully"} 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 => "Tax rate has been updated successfully"} else render :action => "form" end end def destroy @tax_rate.destroy redirect_to :tax_rates, :flash => {:notice => "Tax rate has been removed successfully"} end private def safe_params params[:tax_rate].permit(:name, :rate, :address_type, :country_ids => []) end end end
Version data entries
8 entries across 8 versions & 1 rubygems