From 6a342ae3686833c09f10c2534b8df41fb4ffdb74 Mon Sep 17 00:00:00 2001 From: Viktor Smari Date: Sun, 9 May 2021 00:53:29 +0200 Subject: [PATCH] Ransack.search is deprecated. Use .ransack instead https://github.com/activerecord-hackery/ransack/pull/975 --- app/services/permissions/order.rb | 2 +- lib/open_food_network/order_and_distributor_report.rb | 2 +- lib/open_food_network/order_cycle_management_report.rb | 2 +- lib/open_food_network/payments_report.rb | 2 +- lib/open_food_network/reports/line_items.rb | 2 +- lib/open_food_network/xero_invoices_report.rb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/services/permissions/order.rb b/app/services/permissions/order.rb index 8dbbca41bef..a0c084cf8e3 100644 --- a/app/services/permissions/order.rb +++ b/app/services/permissions/order.rb @@ -44,7 +44,7 @@ def editable_line_items def filtered_orders(orders) return orders unless filter_orders? - orders.complete.not_state(:canceled).search(search_params).result + orders.complete.not_state(:canceled).ransack(search_params).result end def filter_orders? diff --git a/lib/open_food_network/order_and_distributor_report.rb b/lib/open_food_network/order_and_distributor_report.rb index 1bf78bb0670..a82f3008735 100644 --- a/lib/open_food_network/order_and_distributor_report.rb +++ b/lib/open_food_network/order_and_distributor_report.rb @@ -36,7 +36,7 @@ def header def search @permissions.visible_orders.select("DISTINCT spree_orders.*"). complete.not_state(:canceled). - search(@params[:q]) + ransack(@params[:q]) end def table diff --git a/lib/open_food_network/order_cycle_management_report.rb b/lib/open_food_network/order_cycle_management_report.rb index c8b71f242ae..6344a5d5382 100644 --- a/lib/open_food_network/order_cycle_management_report.rb +++ b/lib/open_food_network/order_cycle_management_report.rb @@ -51,7 +51,7 @@ def search not_state(:canceled). distributed_by_user(@user). managed_by(@user). - search(params[:q]) + ransack(params[:q]) end def orders diff --git a/lib/open_food_network/payments_report.rb b/lib/open_food_network/payments_report.rb index 804bb58b45b..2d0d2d8be5f 100644 --- a/lib/open_food_network/payments_report.rb +++ b/lib/open_food_network/payments_report.rb @@ -36,7 +36,7 @@ def header end def search - Spree::Order.complete.not_state(:canceled).managed_by(@user).search(params[:q]) + Spree::Order.complete.not_state(:canceled).managed_by(@user).ransack(params[:q]) end def table_items diff --git a/lib/open_food_network/reports/line_items.rb b/lib/open_food_network/reports/line_items.rb index 88841001dd4..3fcc904246a 100644 --- a/lib/open_food_network/reports/line_items.rb +++ b/lib/open_food_network/reports/line_items.rb @@ -38,7 +38,7 @@ def list(line_item_includes = nil) attr_reader :orders_relation, :order_permissions def search_orders - orders_relation.search(@params[:q]) + orders_relation.ransack(@params[:q]) end # From the line_items given, returns the ones that are editable by the user diff --git a/lib/open_food_network/xero_invoices_report.rb b/lib/open_food_network/xero_invoices_report.rb index fbb6f8fd4fd..93b7dbb4e28 100644 --- a/lib/open_food_network/xero_invoices_report.rb +++ b/lib/open_food_network/xero_invoices_report.rb @@ -20,7 +20,7 @@ def header def search permissions = ::Permissions::Order.new(@user) - permissions.editable_orders.complete.not_state(:canceled).search(@opts[:q]) + permissions.editable_orders.complete.not_state(:canceled).ransack(@opts[:q]) end def orders