Class: Spree::Admin::SearchController

Inherits:
BaseController show all
Defined in:
app/controllers/spree/admin/search_controller.rb

Instance Method Summary collapse

Methods included from BreadcrumbConcern

#add_breadcrumb_icon_instance_var

Instance Method Details

#option_valuesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/spree/admin/search_controller.rb', line 4

def option_values
  query = params[:q]&.strip

  if query.present?
    json = Spree::OptionValue.includes(:option_type).search_by_name(query).map do |ov|
      {
        id: ov.id,
        name: ov.display_presentation
      }
    end

    render json: json
  else
    render json: []
  end
end