From b2d4a7cdc73c7aae2bf5da0ee357cdf4944b031b Mon Sep 17 00:00:00 2001 From: Rainer Dema Date: Wed, 6 Dec 2023 10:37:49 +0100 Subject: [PATCH] Fix order conflict in postgres specs for default scoped models Resolved a `PG::InvalidColumnReference` error in postgres for controllers interfacing with models including the `Spree::NamedType` concern. This concern's default scope, which orders records by the lowercased `name`, conflicted with `SELECT DISTINCT` queries. --- .../app/controllers/solidus_admin/refund_reasons_controller.rb | 2 +- .../controllers/solidus_admin/reimbursement_types_controller.rb | 2 +- .../app/controllers/solidus_admin/return_reasons_controller.rb | 2 +- .../solidus_admin/store_credit_reasons_controller.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/app/controllers/solidus_admin/refund_reasons_controller.rb b/admin/app/controllers/solidus_admin/refund_reasons_controller.rb index e594954e6ac..55a78bbb1da 100644 --- a/admin/app/controllers/solidus_admin/refund_reasons_controller.rb +++ b/admin/app/controllers/solidus_admin/refund_reasons_controller.rb @@ -6,7 +6,7 @@ class RefundReasonsController < SolidusAdmin::BaseController def index refund_reasons = apply_search_to( - Spree::RefundReason.order(id: :desc), + Spree::RefundReason.unscoped.order(id: :desc), param: :q, ) diff --git a/admin/app/controllers/solidus_admin/reimbursement_types_controller.rb b/admin/app/controllers/solidus_admin/reimbursement_types_controller.rb index 41e4fea796a..67eba73f73e 100644 --- a/admin/app/controllers/solidus_admin/reimbursement_types_controller.rb +++ b/admin/app/controllers/solidus_admin/reimbursement_types_controller.rb @@ -6,7 +6,7 @@ class ReimbursementTypesController < SolidusAdmin::BaseController def index reimbursement_types = apply_search_to( - Spree::ReimbursementType.order(id: :desc), + Spree::ReimbursementType.unscoped.order(id: :desc), param: :q, ) diff --git a/admin/app/controllers/solidus_admin/return_reasons_controller.rb b/admin/app/controllers/solidus_admin/return_reasons_controller.rb index 53d92c67b85..ad3a7883218 100644 --- a/admin/app/controllers/solidus_admin/return_reasons_controller.rb +++ b/admin/app/controllers/solidus_admin/return_reasons_controller.rb @@ -6,7 +6,7 @@ class ReturnReasonsController < SolidusAdmin::BaseController def index return_reasons = apply_search_to( - Spree::ReturnReason.order(id: :desc), + Spree::ReturnReason.unscoped.order(id: :desc), param: :q, ) diff --git a/admin/app/controllers/solidus_admin/store_credit_reasons_controller.rb b/admin/app/controllers/solidus_admin/store_credit_reasons_controller.rb index 6596857ca25..db2f088ab9d 100644 --- a/admin/app/controllers/solidus_admin/store_credit_reasons_controller.rb +++ b/admin/app/controllers/solidus_admin/store_credit_reasons_controller.rb @@ -6,7 +6,7 @@ class StoreCreditReasonsController < SolidusAdmin::BaseController def index store_credit_reasons = apply_search_to( - Spree::StoreCreditReason.order(id: :desc), + Spree::StoreCreditReason.unscoped.order(id: :desc), param: :q, )