From 73a899026f08580a0e11839dc323cbe9eedd6b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C3=96zg=C3=BCr?= Date: Wed, 27 May 2020 20:36:25 +0300 Subject: [PATCH] Remove unused XHR code When manually called, fails with `uninitialized constant Spree::Admin::UsersController::LIKE`. --- .../spree/admin/users_controller.rb | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) 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