Class: Spree::Admin::CustomerGroupsController

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

Instance Method Summary collapse

Methods inherited from ResourceController

belongs_to, #create, #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

#select_optionsObject



7
8
9
10
11
12
13
# File 'app/controllers/spree/admin/customer_groups_controller.rb', line 7

def select_options
  q = params[:q]
  ransack_params = q.is_a?(String) ? { name_cont: q } : q
  customer_groups = current_store.customer_groups.accessible_by(current_ability).ransack(ransack_params).result.order(:name).limit(50)

  render json: customer_groups.pluck(:id, :name).map { |id, name| { id: id, name: name } }
end

#showObject



15
16
17
# File 'app/controllers/spree/admin/customer_groups_controller.rb', line 15

def show
  add_breadcrumb @customer_group.name
end