1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/lib/arel/nodes/ordering.rb
Kevin Deisz 66b19b5dec
Allow #nulls_first and #nulls_last in PostgreSQL
When using PostgreSQL, it's useful to be able to specify NULLS FIRST and NULLS LAST on ordered columns. With this commit you can do that now, as in:

```ruby
User.arel_table[:first_name].desc.nulls_last
```
2019-12-31 15:59:59 -05:00

18 lines
312 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; end
class NullsLast < Ordering; end
end
end