Skip to content

Commit

Permalink
Fix order conflict in postgres specs for default scoped models
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rainerdema committed Dec 6, 2023
1 parent 2df44f1 commit b2d4a7c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down

0 comments on commit b2d4a7c

Please sign in to comment.