Class: Spree::Admin::ClassificationsController

Inherits:
ResourceController show all
Defined in:
app/controllers/spree/admin/classifications_controller.rb

Instance Method Summary collapse

Methods inherited from ResourceController

belongs_to, #destroy, #edit, #index, #new, #update

Methods included from TableConcern

#apply_table_sort, #custom_sort_active?, #process_table_query_state, #table, #table_key, #table_registered?

Methods included from BreadcrumbConcern

#add_breadcrumb_icon_instance_var

Instance Method Details

#createObject

create classifications in bulk



11
12
13
14
15
16
17
# File 'app/controllers/spree/admin/classifications_controller.rb', line 11

def create
  products = current_store.products.accessible_by(current_ability, :update).where(id: params[:ids].compact.uniq)
  Spree::Taxons::AddProducts.call(taxons: Spree::Taxon.where(id: parent.id), products: products)

  parent.reload
  @classifications = collection
end