Sha256: 178ba22c7b4eabcb1c5773f15527243024d7e88a9484a471adafb14a5ad0ac15
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
class Shoppe::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, :country_ids => []) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shoppe-0.0.14 | app/controllers/shoppe/tax_rates_controller.rb |
shoppe-0.0.13 | app/controllers/shoppe/tax_rates_controller.rb |
shoppe-0.0.12 | app/controllers/shoppe/tax_rates_controller.rb |