This Week in Rails

July 4, 2025

Deprecating Associations, Cleaner Backtraces, and Smarter Defaults

Hi! Emmanuel Hayford here with some cool updates for you. 😎

Deprecated associations
You can now mark associations as deprecated using:

`has_many :posts, deprecated: true`

Active Record will report any usage of the deprecated association. Three reporting modes are supported: `:warn (default)`, `:raise`, and `:notify`. You can also enable or disable backtraces (disabled by default).

This PR fixes annotate comments to work with `update_all` and `delete_all`.

Add locale options to PostgreSQL adapter DB create
PostgreSQL adapter create DB now supports `locale_provider` and `locale`.

When you generate a new Rails application right now, it will block older browsers. This behavior makes sense if you are using importmap-rails, but if you for example use jsbundling-rails, it does not. This PR suggests only adding this blocker when you are using importmap, and not for all Rails applications.

A new method `ActiveSupport::BacktraceCleaner#clean_locations` allows cleaning an array of `Thread::Backtrace::Location objects`:

`clean_locations = backtrace_cleaner.clean_locations(caller_locations)`

Filters and silencers still receive string representations, while the returned array retains the original `path` attributes, since `Location` objects are immutable.

You can view the whole list of changes here
We had 18 contributors to the Rails codebase this past week!

Until next time!

Subscribe to get these updates mailed to you.

About This Week in Rails

Your weekly inside scoop of interesting commits, pull requests and more from Rails.