Class: SolidusAdmin::ShippingCategoriesController

Inherits:
BaseController
  • Object
show all
Includes:
ControllerHelpers::Search
Defined in:
app/controllers/solidus_admin/shipping_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/shipping_categories_controller.rb', line 20

def destroy
  @shipping_category = Spree::ShippingCategory.find_by!(id: params[:id])

  Spree::ShippingCategory.transaction { @shipping_category.destroy }

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

#indexObject



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

def index
  shipping_categories = apply_search_to(
    Spree::ShippingCategory.order(id: :desc),
    param: :q,
  )

  set_page_and_extract_portion_from(shipping_categories)

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