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.
Controllers now adhere to this default ordering, avoiding explicit 
reordering and the associated errors.
  • Loading branch information
rainerdema committed Dec 5, 2023
1 parent 29bfc1b commit 5d7e041
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.all,
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.all,
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.all,
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.all,
param: :q,
)

Expand Down

0 comments on commit 5d7e041

Please sign in to comment.