Hi,
after I investigated https://github.com/rails/rails/issues/11571 issue,
found that ORDER BY … NULLS FIRST|LAST expression is supported (documented) by ANSI,
and implemented in PostreSQL (MySQL has another options for this feature and does not support for now).
To fix in full that issue reverse_order should generate for “ORDER BY time ASC NULLS FIRST” => "ORDER BY time DESC NULLS LAST".
But adding NULLS FIRST|LAST which are supported only by Postgresql, will add more complexity for reverse_sql_order (https://github.com/rails/rails/blob/master/activerecord/lib/active_record/relation/query_methods.rb#L978)
Another way is remain current implementation and developer should use custom order expression by reorder
topics = Topics.order(‘time ASC NULLS FIRST’)
reversed_topics = topics.reorder('‘time DESC NULLS LAST’)
What do you think?
There is a simple way to do customization, and does Rails need upgraded reverse_order to generate valid SQL for custom ORDER BY expressions?