Dev News Daily ENDE

This Week in Rails fixes regressions in Active Record, URL helpers and the local cache

The This Week in Rails roundup of 6 November, written by Greg, opens by repeating that Rails 8.0.5.2 and 8.1.4.1 are security releases addressing 21 issues. Most of the rest of the week's changes are fixes for regressions introduced by recent refactors on the main branch.

In Active Record, where! and having! accept bind values again; they are marked nodoc, but the post notes that applications and gems such as Discourse and Canvas call them, and a refactor had made where!("id = ?", 1) raise NoMethodError. one? and many? now count :all rather than the select list, which had produced invalid COUNT statements with multiple select values, and on grouped relations they count the groups instead of returning false or raising TypeError. Merging a relation built with with_recursive no longer drops RECURSIVE, in_order_of no longer modifies the relation it was called on, and includes again knows to join a table referenced by a merged order.

URL helpers generate a URL again when a record's to_param is empty and default URL options are set, instead of raising UrlGenerationError, which mattered in mailers. Hash#to_query and Array#to_query skip nested values that serialise to nothing, so a search link no longer comes out as /search?&page=2. On the caching side, anonymous subclasses of cache stores work with LocalCache again, delete_multi keeps the local cache consistent, and reads right after MemCacheStore#write_multi no longer return stale values. Enumerable#index_with goes back to iterating with each after a presizing change broke it for hashes and structs.

This Week in Rails fixes regressions in Active Record, URL helpers and the local cache
This Week in Rails fixes regressions in Active Record, URL helpers and the local cache — Dev News Daily

What it means

A week of fixes like this is what an edge branch is for: the regressions were caught before a release. Applications that track Rails main, or depend on nodoc methods such as where!, are the ones that would have felt them.

Written by Victoria Shinder.