Rails 7.1 adds support for multi-column ordering in ActiveRecord::Batches - BigBinary Blog

In Rails versions prior to 7.1, when batch processing records with a composite primary key, like id_1 and id_2, developers could use the :asc or :desc argument to control the sorting order. However, there was a limitation in how this sorting worked. When you specified the sorting order using :asc or :desc, it affected both id_1 and id_2 simultaneously. In other words, if you requested ascending order, both id_1 and id_2 would be sorted in ascending order together. Similarly, if you requested descending order, both id_1 and id_2 would be sorted in descending order together.This limitation had practical implications, especially when you needed to sort records by different criteria for each part of the composite primary key.
Rails 7.1 adds support for multi-column ordering in ActiveRecord::Batches - BigBinary Blog #ruby #rubydeveloper #rubyonrails #activerecord::batches #bigbinary #blog https://rubyonrails.ba/single/rails-7-1-adds-support-for-multi-column-ordering-in-activerecord-batches-bigbinary-blog

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles