Class: SolidusAdmin::PromotionCategoriesController

Inherits:
BaseController
  • Object
show all
Includes:
ControllerHelpers::Search
Defined in:
app/controllers/solidus_admin/promotion_categories_controller.rb

Instance Method Summary collapse

Methods included from ComponentsHelper

#component

Instance Method Details

#destroyObject



20
21
22
23
24
25
26
27
# File 'app/controllers/solidus_admin/promotion_categories_controller.rb', line 20

def destroy
  @promotion_categories = Spree::PromotionCategory.where(id: params[:id])

  Spree::PromotionCategory.transaction { @promotion_categories.destroy_all }

  flash[:notice] = t('.success')
  redirect_back_or_to promotion_categories_path, status: :see_other
end

#indexObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/solidus_admin/promotion_categories_controller.rb', line 7

def index
  promotion_categories = apply_search_to(
    Spree::PromotionCategory.all,
    param: :q,
  )

  set_page_and_extract_portion_from(promotion_categories)

  respond_to do |format|
    format.html { render component('promotion_categories/index').new(page: @page) }
  end
end