Monkey patch a prepend_order method

This commit is contained in:
Jorge Manrubia
2025-04-11 10:28:12 +02:00
parent 4f3f322528
commit 17aa9b97e9
2 changed files with 17 additions and 6 deletions
+1 -6
View File
@@ -6,12 +6,7 @@ module Card::Golden
has_one :goldness, dependent: :destroy, class_name: "Card::Goldness"
scope :with_golden_first, -> do
left_outer_joins(:goldness).tap do |relation|
# Make sure it can be layered in with other orderings taking precedence.
relation.order_values.unshift("card_goldnesses.id IS NULL")
end
end
scope :with_golden_first, -> { left_outer_joins(:goldness).prepend_order("card_goldnesses.id IS NULL") }
end
def golden?