Source: https://jessewaites.com/blog/post/beware-of-stringify_keys-in-rails-8

# Beware of stringify_keys in Rails 8+!

*October 19, 2025*

Rails 8 introduced a subtle but significant change to the `stringify_keys` method in ActiveSupport. Previously, `stringify_keys` only converted symbol keys in a hash to strings, leaving other key types such as integers untouched. Starting with Rails 8, the method converts **all** keys to strings, including numeric and other non-symbol keys. While this change simplifies behavior in some cases, it can also cause unexpected results if your code depends on mixed key types or relies on accessing hashes with numeric keys.

For example, a hash like `{ 100 => "Testing Testing 123" }` would, prior to Rails 8, still return a value when accessed with 100 after calling `stringify_keys`. In Rails 8, however, the same call will now require `"100"` as the key. This means that code which previously worked with integer-based lookups may now return `nil`, leading to silent failures that are **_very_** difficult to detect. Developers upgrading to Rails 8 should carefully audit their use of `stringify_keys`, particularly in places where data is merged, serialized, or passed between systems that may expect numeric keys. Which is, like, almost 100% of cases.

This change underscores the importance of testing and type awareness in Ruby, especially when dealing with hash transformations and indifferent access. While the new behavior makes key handling more consistent, it may also reveal assumptions in older codebases that were never explicitly tested.
