diff --git a/backend/app/controllers/spree/admin/users_controller.rb b/backend/app/controllers/spree/admin/users_controller.rb index 126d73517fb..0fac0445196 100644 --- a/backend/app/controllers/spree/admin/users_controller.rb +++ b/backend/app/controllers/spree/admin/users_controller.rb @@ -123,21 +123,11 @@ def model_class def collection return @collection if @collection - if request.xhr? && params[:q].present? - @collection = Spree.user_class.includes(:bill_address, :ship_address) - .where("#{Spree.user_class.table_name}.email #{LIKE} :search - OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = #{Spree.user_class.table_name}.bill_address_id) - OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = #{Spree.user_class.table_name}.bill_address_id) - OR (spree_addresses.firstname #{LIKE} :search AND spree_addresses.id = #{Spree.user_class.table_name}.ship_address_id) - OR (spree_addresses.lastname #{LIKE} :search AND spree_addresses.id = #{Spree.user_class.table_name}.ship_address_id)", - { search: "#{params[:q].strip}%" }) - .limit(params[:limit] || 100) - else - @search = Spree.user_class.ransack(params[:q]) - @collection = @search.result.includes(:spree_roles) - @collection = @collection.includes(:spree_orders) - @collection = @collection.page(params[:page]).per(Spree::Config[:admin_products_per_page]) - end + + @search = Spree.user_class.ransack(params[:q]) + @collection = @search.result.includes(:spree_roles) + @collection = @collection.includes(:spree_orders) + @collection = @collection.page(params[:page]).per(Spree::Config[:admin_products_per_page]) end def user_params