Sha256: 1b292b27d97a50e11169f3728383612a79d217e2c0fb1d806e9f1d9416044142

Contents?: true

Size: 937 Bytes

Versions: 70

Compression:

Stored size: 937 Bytes

Contents

module Spree
  module Admin
    class SearchController < Spree::Admin::BaseController
      # http://spreecommerce.com/blog/2010/11/02/json-hijacking-vulnerability/
      before_filter :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

70 entries across 70 versions & 3 rubygems

Version Path
spree_backend-2.3.13 app/controllers/spree/admin/search_controller.rb
spree_backend-2.2.14 app/controllers/spree/admin/search_controller.rb
spree_backend-2.3.12 app/controllers/spree/admin/search_controller.rb
spree_backend-2.2.13 app/controllers/spree/admin/search_controller.rb
spree_backend-2.3.11 app/controllers/spree/admin/search_controller.rb
spree_backend-2.2.12 app/controllers/spree/admin/search_controller.rb
spree_backend-2.3.10 app/controllers/spree/admin/search_controller.rb
spree_backend-2.3.9 app/controllers/spree/admin/search_controller.rb
spree_backend-2.2.11 app/controllers/spree/admin/search_controller.rb
spree_backend-2.2.10 app/controllers/spree/admin/search_controller.rb
spree_backend-2.3.8 app/controllers/spree/admin/search_controller.rb
spree_backend-2.3.7 app/controllers/spree/admin/search_controller.rb
spree_backend-2.2.9 app/controllers/spree/admin/search_controller.rb
spree_backend-2.1.12 app/controllers/spree/admin/search_controller.rb
spree_backend-2.3.6 app/controllers/spree/admin/search_controller.rb
spree_backend-2.2.8 app/controllers/spree/admin/search_controller.rb
spree_backend-2.1.11 app/controllers/spree/admin/search_controller.rb
spree_backend-2.3.5 app/controllers/spree/admin/search_controller.rb
spree_backend-2.2.7 app/controllers/spree/admin/search_controller.rb
spree_backend-2.1.10 app/controllers/spree/admin/search_controller.rb