📝
article
blog.saeloun.com
·
October 17, 2026
Rails 8.2 adds Relation#default_order
Rails 8.2 adds default_order to Active Record relations. It provides a default sort that applies only when the query has no explicit order . The feature is currently available on Rails main , not in Rails 8.1.4. Consider a catalog that lists products by name, but also lets us sort by price. Our products are Apron at 30, Mug at 10, and Notebook at 20. Before Calling order on an already ordered relation adds another sort column. The original column still takes priority: products = Product . ord...
Read on blog.saeloun.com →