Class: SolidusAdmin::PropertiesController

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

Instance Method Summary collapse

Methods included from ComponentsHelper

#component

Instance Method Details

#destroyObject



22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/solidus_admin/properties_controller.rb', line 22

def destroy
  @properties = Spree::Property.where(id: params[:id])

  Spree::Property.transaction do
    @properties.destroy_all
  end

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

#indexObject



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

def index
  properties = apply_search_to(
    Spree::Property.order(created_at: :desc, id: :desc),
    param: :q,
  )

  set_page_and_extract_portion_from(
    properties,
  )

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