mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
4a13f8ad4f
If you're using the `nulls_first` or `nulls_last` functionality with an explicit ordering, then previously it wasn't properly handling calls to `#reverse` (called through `reverse_order`). This commit changes the behavior to match what would be expected.
27 lines
448 B
Ruby
27 lines
448 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Arel # :nodoc: all
|
|
module Nodes
|
|
class Ordering < Unary
|
|
def nulls_first
|
|
NullsFirst.new(self)
|
|
end
|
|
|
|
def nulls_last
|
|
NullsLast.new(self)
|
|
end
|
|
end
|
|
|
|
class NullsFirst < Ordering
|
|
def reverse
|
|
NullsLast.new(expr.reverse)
|
|
end
|
|
end
|
|
|
|
class NullsLast < Ordering
|
|
def reverse
|
|
NullsFirst.new(expr.reverse)
|
|
end
|
|
end
|
|
end
|
|
end
|