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?

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to