Class: Shoppe::TaxRatesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/shoppe/tax_rates_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
# File 'app/controllers/shoppe/tax_rates_controller.rb', line 15

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

#destroyObject



36
37
38
39
# File 'app/controllers/shoppe/tax_rates_controller.rb', line 36

def destroy
  @tax_rate.destroy
  redirect_to :tax_rates, :flash => {:notice => "Tax rate has been removed successfully"}
end

#editObject



24
25
26
# File 'app/controllers/shoppe/tax_rates_controller.rb', line 24

def edit
  render :action => "form"
end

#indexObject



6
7
8
# File 'app/controllers/shoppe/tax_rates_controller.rb', line 6

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

#newObject



10
11
12
13
# File 'app/controllers/shoppe/tax_rates_controller.rb', line 10

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

#updateObject



28
29
30
31
32
33
34
# File 'app/controllers/shoppe/tax_rates_controller.rb', line 28

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