Sha256: 71dae5720d233ea7661115d438ea23603763cad4a0af5a6f0a0c3ec326d69b18

Contents?: true

Size: 934 Bytes

Versions: 14

Compression:

Stored size: 934 Bytes

Contents

module Spree
  module Admin
    class SearchController < Spree::Admin::BaseController
      # http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/
      before_action :check_json_authenticity, only: :index
      respond_to :json

      # TODO: Clean this up by moving searching out to user_class_extensions
      # And then JSON building with something like Active Model Serializers
      def users
        if params[:ids]
          @users = Spree.user_class.where(:id => params[:ids].split(','))
        else
          @users = Spree.user_class.ransack({
            :m => 'or',
            :email_start => params[:q],
            :ship_address_firstname_start => params[:q],
            :ship_address_lastname_start => params[:q],
            :bill_address_firstname_start => params[:q],
            :bill_address_lastname_start => params[:q]
          }).result.limit(10)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
spree_backend-2.4.10 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.9 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.8 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.7 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.6 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.5 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.4 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.3 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.2 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.1 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.0 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.0.rc3 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.0.rc2 app/controllers/spree/admin/search_controller.rb
spree_backend-2.4.0.rc1 app/controllers/spree/admin/search_controller.rb