Class: Workarea::Admin::FixedPricesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/admin/fixed_prices_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/workarea/admin/fixed_prices_controller.rb', line 17

def create
  if @fixed_price.save
    flash[:success] = t('workarea.admin.fixed_prices.flash_messages.saved', sku: @sku.id)
    redirect_to pricing_sku_fixed_prices_path(@sku)
  else
    @sku.reload
    flash.now[:error] = t('workarea.admin.fixed_prices.flash_messages.create_error')
    render :new
  end
end

#destroyObject



41
42
43
44
45
46
# File 'app/controllers/workarea/admin/fixed_prices_controller.rb', line 41

def destroy
  @fixed_price.destroy

  flash[:success] = t('workarea.admin.fixed_prices.flash_messages.deleted', sku: @sku.id)
  redirect_to pricing_sku_fixed_prices_path(@sku)
end

#editObject



28
29
# File 'app/controllers/workarea/admin/fixed_prices_controller.rb', line 28

def edit
end

#indexObject



10
11
# File 'app/controllers/workarea/admin/fixed_prices_controller.rb', line 10

def index
end

#newObject



13
14
15
# File 'app/controllers/workarea/admin/fixed_prices_controller.rb', line 13

def new
  @fixed_price = GlobalE::FixedPrice.new(fixed_price_params)
end

#updateObject



31
32
33
34
35
36
37
38
39
# File 'app/controllers/workarea/admin/fixed_prices_controller.rb', line 31

def update
  if @fixed_price.update_attributes(fixed_price_params)
    flash[:success] = t('workarea.admin.fixed_prices.flash_messages.saved', sku: @sku.id)
    redirect_to pricing_sku_fixed_prices_path(@sku)
  else
    flash.now[:error] = t('workarea.admin.fixed_prices.flash_messages.update_error')
    render :edit, status: :unprocessable_entity
  end
end