This Week in Rails

February 28, 2025

Ignoring indexes in MySQL has never been so easy...

Hey, zzak here. Last week was a short one, so we took the week off, let’s catch up.

Heads up: the Rails World CFP will open on March 11th.
The 2025 landing page is currently being built, but if you are going to submit a talk, keep an eye on: rubyonrails.org/world/

Add Podman instructions for devcontainers
This is not necessarily a change to Rails itself, but worth noting that you don’t have to rely on Docker to use devcontainers and we actually use Podman to test the rails new flow in CI as well.

Add login_as(user) testing helper when generating authentication
When using the Authentication generator, you now get sign_in_as(user) and sign_out test helper methods.

Introduce “ActiveSupport::ErrorReport#add_middleware”
This PR introduces the concept of a middleware stack to the ErrorReporter. Middleware are used to add or mutate the context which the error being reported occurs, and can be added using add_middleware.

Add “report” option to “ActiveJob::Base#retry_on” and “#discard_on”
When using Active Job you can now specify to report errors to ErrorReporter when retrying or discarding jobs occurs.

Support disabling indexes for MySQL v8+ and MariaDB v10.6+
This PR takes advantage of “invisible” or “ignored” indexes in newer versions of MySQL and MariaDB, which can be managed using migrations.
See the MySQL or MariaDB docs for more.

Add column types to “ActiveRecord::Result” for SQLite3
When using the SQLite3 adapter you can now get the column type information from a query using column_types.

Raise “ActiveRecord::ReadOnlyError” when pessimistically locking with a readonly role
This PR ensures that calling lock! when current_preventing_writes is enabled will raise an error to improve the usability in this scenario.

Ensure “reverse_order” respects “implicit_order_column”
This PR makes sure that reverse_order takes into account the model implicit_order_column when reversing the order.

Add SafeBuffer to the list of messagepack serializable type
When using MessagePack to serialize cookies, this PR fixes an issue when trying to persist SafeBuffer type objects in a cookie.

Fix “LocalStore#read_multi_entries” to distinguish recorded misses
This PR addresses a bug when using LocalStore cache where a read or exists? check for a key would inadvertently result in consecutive fetch_multi calls return nil for the value.

Add Timezone America/Asuncion
They stopped observing DST last year, and a new IANA timezone was added.

Add “prepend” method to “MessageEncryptors” and “MessageVerifiers”
This adds a #prepend method to ActiveSupport::MessageEncryptors and ActiveSupport::MessageVerifiers.
This method behaves like #rotate, but it prepends to the list instead of appends. Thus it can be used to override the way messages are generated for preconfigured instances such as Rails.application.message_verifiers.

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

Until next time!

About This Week in Rails

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