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

推荐订阅源

Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
有赞技术团队
有赞技术团队
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements
Y
Y Combinator Blog
Vercel News
Vercel News
Martin Fowler
Martin Fowler
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LangChain Blog
云风的 BLOG
云风的 BLOG
H
Hackread – Cybersecurity News, Data Breaches, AI and More
aimingoo的专栏
aimingoo的专栏
G
Google Developers Blog
The GitHub Blog
The GitHub Blog
N
Netflix TechBlog - Medium
Google DeepMind News
Google DeepMind News
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
F
Fortinet All Blogs

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
Retry known idempotent SELECT queries, New Active Record ...
David Heinemeier Hansson · 2024-03-29 · via Ruby on Rails: Compress the complexity of modern web apps

Friday, March 29, 2024
Posted by Emmanuel Hayford

Greetings! I’m Emmanuel Hayford, here to bring you your weekly instalment of “This Week In Rails”. Let’s dive straight into it.   Two new guides are now open for community review. If you are well versed in Action View, partials, and helpers, please review and submit your feedback here:

Add config.active_record.permanent_connection_checkout setting
This setting determines the action taken when ActiveRecord::Base.connection is accessed: whether it raises an error, emits a deprecation warning, or does nothing.

ActiveRecord::Base.connection acquires a database connection from the pool and maintains it until the request or job concludes. However, this behaviour may prove undesirable in environments with more threads or fibers than available connections.

This configuration facilitates the identification and elimination of code utilising ActiveRecord::Base.connection, encouraging migration to ActiveRecord::Base.with_connection instead. The default behaviour remains unaltered.

Make ActiveSupport::BacktraceCleaner copy filters on dup
Enhance ActiveSupport::BacktraceCleaner to replicate filters and silencers during duplication and cloning.

Previously, duplication still resulted in shared internal silencers and filters arrays, leading to state leakage.

Ensure necessary options are added to association options
Noting the typo in :through, take the following code sample as an example:

class User < ApplicationRecord
    has_many :courses
    has_many :assignments, trough: :courses
end

You’d get a misleading error along the lines of

“Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors (ArgumentError)”,

with this pull request, you’ll now get a clearer message, more like:

“Unknown key: :trough. Valid keys are: :class_name, :anonymous_class, :primary_key, …, :index_errors, :through (ArgumentError)”.

Note that in the second error message :through is included in the list of valid options.

Retry known idempotent SELECT queries on connection-related exceptions
Implements a mechanism to automatically retry SELECT queries that are known to be idempotent in the event of connection-related exceptions.

Queries constructed through Arel tree traversal or based on known model attributes are inherently idempotent and can be safely retried upon encountering a connection error. Previously, certain adapters like TrilogyAdapter would raise ActiveRecord::ConnectionFailed: Trilogy::EOFError when faced with a connection error during a request.

We had 22 contributors to the Rails codebase this past week!

Take care.

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

Subscribe to get these updates mailed to you.