惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 聂微东
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
C
Check Point Blog
M
MIT News - Artificial intelligence
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
H
Help Net Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
DataBreaches.Net
大猫的无限游戏
大猫的无限游戏
D
Docker
Last Week in AI
Last Week in AI
IT之家
IT之家
F
Fortinet All Blogs
A
About on SuperTechFans
P
Proofpoint News Feed
The Cloudflare Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog RSS Feed
博客园_首页
月光博客
月光博客
博客园 - 司徒正美
Y
Y Combinator Blog

Ruby on Rails: Compress the complexity of modern web apps

Safer to_i coercion, custom to_fs formats, and more! This Week in Rails: May 16, 2026 This Week in Rails: May 8, 2026 This Week in Rails: May 1, 2026 Active Record gets better every week Great big Rails World 2026 update: CFP, Corporate Support tickets, workshops Query command for database queries and more Explicit query: and body: kwargs for integration tests and more! Speedup ActiveRecord::LogSubscriber#sql_color and more! This Week in Rails: March 27, 2026 Rails Versions 8.0.5 and 8.1.3 have been released! Rails Versions 7.2.3.1, 8.0.4.1, and 8.1.2.1 have been released! This Week in Rails: March 20, 2026 Validate URI scheme in Action Text and more This Week in Rails: March 6, 2026 Planning Center is the newest Rails Foundation Contributing member Action Text gets Markdown conversion, editor links in devcontainers, and more! BARRA seeks Rails developer Joe Agliozzo is looking for a Rails developer The rise of lighttpd as the alternative web server When longer is better and more is more Snowdevil: First e-tailer on Rails Natural selection for frameworks in Ruby vs Java Address book tutorial in Portuguese Becoming a better programmer with Rails 10 Things Every Java Programmer Should Know About Ruby Really Getting Started in Rails Off the Treadmill, Onto the Rails Rails 0.9.5: A world of fixes and tweaks Rich clients with Rails and XUL
Active Support Instrumentation Documentation, QueryIntent...
David Heinemeier Hansson · 2025-11-28 · via Ruby on Rails: Compress the complexity of modern web apps

Friday, November 28, 2025
Posted by vipulnsward

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

Active Support Instrumentation Documentation
This Pull Request updates the Active Support Instrumentation documentation to receive various additions, improvements and more. It is now open for review and feedback from the community!

Ensure TimeWithZone#as_json always returns a UTF-8 string
This PR addresses a regression in Rails 8.1.0 where ActiveSupport::TimeWithZone#as_json was returning strings with incorrect encoding. Since Time#xmlschema returns a US-ASCII encoded string, as_json was returning US-ASCII instead of UTF-8. The fix ensures that the JSON representation always returns a properly encoded UTF-8 string.

Handle closed PostgreSQL connections in retryable_query_error?
When a PostgreSQL connection dies unexpectedly, retryable_query_error? calls @raw_connection.transaction_status, which raises PG::ConnectionBad on a closed connection. The PostgreSQL adapter’s retryable_query_error? previously handled two scenarios: when the connection is nil or when it’s alive. This PR adds handling for a third case where the connection object exists but is closed, by rescuing PG::ConnectionBad and allowing the retry logic to proceed appropriately.

Handle asynchronous raise in all of reconnect!
Three operations—reconnect, reset_transaction, and clear_cache—could take considerable time and remain susceptible to TimeoutError exceptions, potentially corrupting connection state. This change extends the exception-handling approach to fully encompass the entire reconnect! method.

Ensure variants are loaded and processed synchronously just once
A fix has been introduced to avoid reprocessing variants during preview redirects. Previously, when generating a preview (e.g., for PDFs or videos), Active Storage would create the variant on the primary database, but a second lookup happened on a read replica before replication caught up — causing unnecessary reprocessing and failures. The change ensures the same variant instance is reused within the request, preventing redundant database queries and variant creation errors.

Fix TimeWithZone#xmlschema when wrapping DateTime local time ActiveSupport::TimeWithZone#xmlschema was producing invalid ISO-8601 strings when instantiated with a DateTime used as local time. The implementation incorrectly assumed that time.iso8601 always ends with "Z".

tz  = ActiveSupport::TimeZone["America/New_York"]
twz = ActiveSupport::TimeWithZone.new(nil, tz, DateTime.new(2025, 11, 7, 12))

twz.xmlschema
# Before
"2025-11-07T12:00:00+00:0-05:00" # invalid

# After
"2025-11-07T12:00:00-05:00" # correct

The fix updates the method to replace the entire timezone suffix (whether Z or ±HH:MM) instead of just the final character, ensuring correct timezone offset calculation for both Time and DateTime instances.

Fix CI eager loading when rake tasks invoke :environment before tests
The test environment sets config.eager_load = ENV["CI"].present? to enable eager loading in CI and catch autoloading bugs. However, when gems invoke the :environment rake task before tests run, Rails overrides this setting with config.rake_eager_load (which defaults to false), disabling eager loading in CI. This PR adds config.rake_eager_load = ENV["CI"].present? to the generated test environment configuration, ensuring eager loading behavior remains consistent in CI regardless of whether rake tasks trigger the :environment hook.

QueryIntent#execute!
This PR introduces QueryIntent#execute! to improve Active Record’s internal query execution architecture. Previously, query intents were passive containers passed through the system, but now they can actively execute queries and store results. This refactoring makes QueryIntent instances self-sufficient. They know which adapter they belong to and can ask the adapter to do work like query preprocessing. The change streamlines the query execution flow and sets the foundation for better handling of query results in different formats (raw or cast).

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

Until next time!

Subscribe to get these updates mailed to you.