Rails 6's implicit_order_column
is great but wouldn't it be even more great if it worked for more than just finders (e.g. first
, last
)? It's reasonable to expect, after declaring an implicit order column, for it to also be in effect when using other methods (e.g. all
, take
, pluck
, each
, associations) — but it is not.
IMO default_scope
is not really a substitute, either, unless you want everyone else to always have to remember to call .reorder
if a different order is needed. In my view, scope
is more of a filtering thing than an ordering thing anyway, and I always wish there had been an analogous order macro.
I think implicit_order
is needed (taking a block, not just a column name, so that direction or joins, etc, can be specified). As soon as a different .order
is called, this one should be dropped entirely.