Ruby on Rails — June 2025
All the Rails News That Matters, Once a Month!
Hey everyone — Sajjad Umar here with the June edition of Ruby on Rails Monthly!
As we reach the year’s midpoint, the Rails ecosystem continues its impressive momentum with critical security updates, database enhancements, and exciting community events. This month brings us smarter Active Job handling, important Trix vulnerability patches, and new cache control capabilities — all while the Rails team prepares for the historic final RailsConf. Let’s explore what’s been shaping the Rails landscape these past weeks!
I’ve tried a new format for this newsletter! Tell me in the comments: does this work better for you?
Our Proud Partners
Rails Foundation Announcement
The Rails Foundation confirmed that Rails World 2025 sessions will be recorded and published on YouTube:
Community Guides Needing Your Input
Three documentation improvements are open for community review:
Why participate? Your review ensures these resources stay accurate for the entire community!
Final RailsConf Announcement
The last RailsConf (July 8–10, Philadelphia) will feature:
SQLite Adapter Precision Fix
PR #55180 brings accurate row counting to SQLite:
# Before: Inconsistent counts
User.where(active: true).update_all(status: :verified)
# => Might report incorrect numbers due to cascading deletes
# After: Precise affected rows
User.where(active: true).update_all(status: :verified)
# => Returns exact count of modified records
Key improvements:
Affects all SQLite users — especially important for audit trails
Unified Transaction Isolation Control
PR #55176 simplifies isolation management:
# New streamlined approach
ActiveRecord.with_transaction_isolation_level(:serializable) do
Shard1.connection.transaction { ... }
Shard2.connection.transaction { ... }
end
# Old method: Manual per-connection setup
[Shard1, Shard2].each do |shard|
shard.connection_pool.with_connection do |conn|
conn.transaction(isolation: :serializable) { ... }
end
end
Why this matters:
Essential for financial systems and multi-tenant applications
Active Job Continuations Upgrade
PR #55174 enhances pausable jobs:
class DataExportJob < ApplicationJob
include ActiveJob::Continuations
def perform
checkpoint :extract_data, retry: :exponential
checkpoint :transform, retry: [3, 5.minutes]
checkpoint :load_to_warehouse
end
end
Key improvements:
Critical for ETL pipelines and long-running background tasks
PostgreSQL Documentation Restructuring
The PostgreSQL-specific guide has been integrated into Rails’ core API documentation. This change helps developers by:
Active Job Continuations Refinements
Building on last month’s pausable jobs feature, this update addresses edge cases discovered during real-world use:
Action Text Upload Progress Accuracy
File upload progress bars now reflect server-side processing time. Previously, progress indicators would stall at 100% during server processing. The update:
Current Attributes Leak Fix
Fixed a subtle memory leak where Current attributes could persist between requests. This could cause:
Minitest Plugin Compatibility
Resolved conflicts with test plugins like minitest-focus by changing test loading order:
CI Optimization
Eliminated duplicate test runs in GitHub Actions:
HEAD Request Compliance
Fixed Rack::Lint violations to meet RFC9110 standards:
Recommended by LinkedIn
Job Retry Consistency
Preserves original job attributes during retries:
Active Job Continuations Introduction
PR #55127 adds pausable/resumable jobs:
class DataImportJob
include ActiveJob::Continuable
def perform(import_id)
@import = Import.find(import_id)
step :initialize do
@import.prepare # Runs immediately
end
step :process do |step|
@import.records.find_each(start: step.cursor) do |record|
record.transform
step.advance!(from: record.id) # Saves progress
end
end
step :finalize # Method-based step
end
private
def finalize
@import.cleanup # Runs after resumption
end
end
Key benefits:
GitHub Actions Optimization
PR #55120 simplifies CI configuration by removing redundant ruby-version input - the setup-ruby action now automatically detects .ruby-version files.
Reflection Cache Performance
PR #55115 boosts association performance by memoizing reflection validations. Since associations can’t change after definition, this:
Rails DOM Testing 2.3.0
New release adds:
assert_not_dom expected, actual
# Equivalent to: assert_not_equal expected, actual
Use case:
Documentation Clarification: Polymorphic :through Restriction
Rails now explicitly documents that polymorphic associations cannot be used with :through. This restriction exists because polymorphic associations rely on dual-column references (_id + _type), while :through assumes single-column foreign keys. Attempting this pattern already raised errors, but the exception was previously undocumented. Implementation details in PR #55107
Deprecation Notice: :class_name in Polymorphic belongs_to
Using :class_name with polymorphic belongs_to is now deprecated (scheduled for removal in Rails 8.1). The _type column already stores the associated class name, making this option redundant and potentially misleading. Deprecation rationale in PR #55091
# DEPRECATED (remove class_name):
belongs_to :reviewable, polymorphic: true, class_name: "Product"
# CORRECT:
belongs_to :reviewable, polymorphic: true
Enhanced Database Control: Namespaced db:migrate:reset
This PR introduces database-specific reset commands for multi-DB setups. This prevents accidental full-database resets in production and enables targeted schema management. Command implementation in PR #55077
# Resets ONLY primary database:
bin/rails db:migrate:reset:primary
# Resets animals database:
bin/rails db:migrate:reset:animals
Schema Loading Fix: SCHEMA_FORMAT Consistency
The db:schema:load command now correctly respects ENV["SCHEMA_FORMAT"] in Rails 7.2. This fixes CI/CD workflows where schema format differs between environments by allowing runtime overrides of config.active_record.schema_format. Behavior fix in PR #55059
# Load SQL structure:
SCHEMA_FORMAT=sql bin/rails db:schema:load
# Load Ruby schema:
SCHEMA_FORMAT=ruby bin/rails db:schema:load
Database Operation Insights
PR #55060 introduces affected_rows for SQL operations:
result = ActiveRecord::Base.connection.exec_query("
UPDATE posts SET status = 'published'
WHERE created_at < NOW() - INTERVAL '1 year'
")
result.affected_rows # => 342
Use cases:
Action Text Maintenance Improvements
Ruby 3.5 Compatibility
PR #55037 optimizes CGI handling:
HTTP Cache Control Directives
PR #55033 implements RFC-9111 support:
# Check client cache directives
if request.cache_control_directives.max_stale?
serve_stale_content
elsif request.cache_control_directives.no_cache?
force_fresh_response
end
New directives available:
Sharpen Your Rails Skills This Summer As we wrap up this edition, I want to extend a special opportunity for those looking to deepen their Rails expertise. My book “Ruby on Rails for Agile Web Development” is now available with a 30% summer discount — perfect for your seasonal learning goals!
Why this book belongs in your toolkit:
Limited-time offer: Use code SUMMER30 at checkout for instant savings: Get Your Discounted Copy
Until next month, keep building extraordinary things with Rails! The community thrives when we share knowledge and grow together.
Sajjad Umar Founder, Ruby on Rails Monthly Share this newsletter with a colleague
OR Subscribe on Linked: https://www.garudax.id/build-relation/newsletter-follow?entityUrn=6923566487630675968