1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
module ActiveRecord class Base def self.nulls_last(field, direction = 'ASC') if Gitlab::Database.postgresql? "#{field} #{direction} NULLS LAST" else if direction.upcase == 'ASC' "-#{field} DESC" else "#{field} DESC" end end end end end