Class: Tienda::TaxRatesController

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

Instance Method Summary collapse

Instance Method Details

#createObject



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

def create
  @tax_rate = Tienda::TaxRate.new(safe_params)
  if @tax_rate.save
    redirect_to :tax_rates, flash: { notice: t('tienda.tax_rates.create_notice') }
  else
    render action: "form"
  end
end

#destroyObject



37
38
39
40
# File 'app/controllers/tienda/tax_rates_controller.rb', line 37

def destroy
  @tax_rate.destroy
  redirect_to :tax_rates, flash: { notice: t('tienda.tax_rates.destroy_notice') }
end

#editObject



25
26
27
# File 'app/controllers/tienda/tax_rates_controller.rb', line 25

def edit
  render action: "form"
end

#indexObject



7
8
9
# File 'app/controllers/tienda/tax_rates_controller.rb', line 7

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

#newObject



11
12
13
14
# File 'app/controllers/tienda/tax_rates_controller.rb', line 11

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

#updateObject



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

def update
  if @tax_rate.update(safe_params)
    redirect_to [:edit, @tax_rate], flash: { notice: t('tienda.tax_rates.update_notice') }
  else
    render action: "form"
  end
end