Saturday, May 16, 2026

This Week in Rails: May 16, 2026

Posted by Greg

Hi, it’s Greg. Let’s explore this week’s changes in the Rails codebase.

Rails World 2026 update
General Admission tickets are now out, and the CFP is closing this weekend. Book your ticket or apply to speak at: https://rubyonrails.org/world/2026.

A new add-on tutorial is ready for community review This builds on the existing e-commerce app and adds a complete Product Reviews system with ratings, image uploads, rating filtering, and admin management. If you want to help by reviewing, leave your feedback in the PR here: https://github.com/rails/rails/pull/57244
Also, there are 2 new guides ready for community review: https://github.com/rails/rails/pull/57371 and https://github.com/rails/rails/pull/57348.

Add default #render_in implementation to ActiveModel::Conversion
This pull request adds a default #render_in implementation to ActiveModel::Conversion With the following view partial:

<%# app/views/people/_person.html.erb %>
<% local_assigns.with_defaults(shout: false) => { shout: } %>

<%= shout ? person.name.upcase : person.name %>

Callers can render an instance of Person as a positional argument or a :renderable option:

person = Person.new(name: "Ralph")

render person                                       # => "Ralph"
render person, shout: true                          # => "RALPH"
render renderable: person                           # => "Ralph"
render renderable: person, locals: { shout: true }  # => "RALPH"

Disable freezing of NATIVE_DATABASE_TYPES for SQLite3 adapter
NATIVE_DATABASE_TYPES is a well-known extension point — gems like neighbor and activerecord-enhancedsqlite3-adapter mutate it to register custom types (e.g. vector) or similar gems try to extend the hash. With .freeze in place those gems crashed with FrozenError: can't modify frozen Hash at load time, but this pull request fixes this.

Handle missing Mandrill ingress signatures
This pull request changes the Mandrill authenticator to require a present signature before comparing it with the expected HMAC. Missing signatures now fail authentication and return 401 Unauthorized, matching the behavior for forged signatures.

Add start_day argument to this_week? for consistency with all_week
this_week? now accepts an optional start_day argument, matching the existing interface of all_week, beginning_of_week, and end_of_week.

date.this_week?           # Uses global default (unchanged)
date.this_week?(:sunday)  # Sun–Sat week
date.this_week?(:monday)  # Mon–Sun week

Allow array syntax for expression indexes in add_index
This change allows passing expressions in array syntax for add_index method. For example, add_index :users, [ "lower(email)" ] now works the same as add_index :users, "lower(email)".

# This now works properly:
add_index :users, [ "lower(email)" ]

# As does this:
add_index :users, [ "lower(email)", :status ]

Active Storage: implement attach!
This pull request implements attach! as a bang counterpart to attach.

This method raises an exception if the attachment was not saved, similar to how save! raises an exception if an Active Record object is found to be invalid prior to be persisted.

Fix unexpected behavior for dependent: :purge
This change corrects unexpected behavior resulting from dependent: :purge when using has_one_attached or has_many_attached.

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

Until next time!

Subscribe to get these updates mailed to you.