Hi Andrew, So far we've managed to entirely avoid using SQL literals for this component, instead relying on (and trusting) Arel. If possible I'd like to keep that constraint, because it has a number of safety advantages (namely, discouraging the use of SQL literals). Arel nodes also arguably have better ergonomics, in that we can fold them together using #and and #or and be fairly confident that we'll get valid SQL out at the end.
On 15 August 2018 at 12:29, Andrew Kaspick <akasp...@gmail.com> wrote: > I just use a raw sql string for NULLS LAST. > > On Wed, Aug 15, 2018 at 4:16 AM harrymaclean via Ruby on Rails: Core < > rubyonrails-core@googlegroups.com> wrote: > >> Hi team! >> >> We're currently using Arel to dynamically construct complex SQL queries >> that power sorting and pagination in our API. One of the features we'd like >> to make use of is the NULLS LAST modifier in ORDER BY clauses. Arel has no >> support for this, but it's a small and straightforward patch (see >> https://github.com/hmac/rails/commit/7cab443ab1e67536d8d4e7a49c7126 >> c815a96ad5). >> >> Would anyone be against adding this feature? >> >> Further info: >> >> - the patch only adds support for PostgreSQL since I know it supports >> this feature - I'm happy to add it to other visitors if we can confirm >> their support. >> - similarly, we can easily add NULLS FIRST support as well (we don't need >> it ourselves so it's not included here). >> >> Thanks! >> >> -- >> 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 rubyonrails-core+unsubscr...@googlegroups.com. >> To post to this group, send email to rubyonrails-core@googlegroups.com. >> Visit this group at https://groups.google.com/group/rubyonrails-core. >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ruby on Rails: Core" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/rubyonrails-core/VsoBNk4_JFE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > rubyonrails-core+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at https://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/d/optout. > -- 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 rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at https://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.