Class: Workarea::Admin::PricesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/workarea/admin/prices_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model

Methods included from Publishing

#allow_publishing!, #allow_publishing?, #set_publishing_options

Methods included from Visiting

#most_visited

Instance Method Details

#createObject



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

def create
  if @price.save
    flash[:success] =
      t('workarea.admin.prices.flash_messages.saved', sku: @sku.id)
    redirect_to pricing_sku_prices_path(@sku)
  else
    render :index, status: :unprocessable_entity
  end
end

#destroyObject



39
40
41
42
43
44
45
# File 'app/controllers/workarea/admin/prices_controller.rb', line 39

def destroy
  @price.destroy

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

#editObject



26
27
# File 'app/controllers/workarea/admin/prices_controller.rb', line 26

def edit
end

#indexObject



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

def index
end

#newObject



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

def new
end

#updateObject



29
30
31
32
33
34
35
36
37
# File 'app/controllers/workarea/admin/prices_controller.rb', line 29

def update
  if @price.update_attributes(price_params)
    flash[:success] =
      t('workarea.admin.prices.flash_messages.saved', sku: @sku.id)
    redirect_to pricing_sku_prices_path(@sku)
  else
    render :edit, status: :unprocessable_entity
  end
end