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

推荐订阅源

D
Docker
博客园 - 【当耐特】
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
大猫的无限游戏
大猫的无限游戏
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Cloudflare Blog
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
Martin Fowler
Martin Fowler
云风的 BLOG
云风的 BLOG
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
F
Fortinet All Blogs
Y
Y Combinator Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
MyScale Blog
MyScale Blog
B
Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
人人都是产品经理
人人都是产品经理

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
ActiveRecord::Base#pluck accepts hash values, devcontaine...
David Heinemeier Hansson · 2024-04-19 · via Ruby on Rails: Compress the complexity of modern web apps

Friday, April 19, 2024
Posted by vipulnsward

Hey everyone, Happy Friday! I hope you get some time to unwind and relax going into the weekend 😎

Vipul here with the latest updates for This Week in Rails. Let’s dive in.

Allow ActiveRecord::Base#pluck to accept hash values
This change adds support for ActiveRecord::Base#pluck to accept hash values.

# Before
Post.joins(:comments).pluck("posts.id", "comments.id", "comments.body")

# After
Post.joins(:comments).pluck(posts: [:id], comments: [:id, :body])

The same applies to .pick, which is implemented using .pluck.

Fix child association loading in :n_plus_one_only mode
Strict loading in :n_plus_one_only mode is designed to prevent performance issues when deeply traversing associations. It allows Person.find(1).posts, but not Person.find(1).posts.map(&:category). This fix avoids the surprise that occurs when person.posts.first eagerly loads the whole association rather than allowing the user to manage the child association.

person = Person.find(1)
person.strict_loading!(mode: :n_plus_one_only)

# Before
person.posts.first
# SELECT * FROM posts WHERE person_id = 1; -- non-deterministic order

# After
person.posts.first # this is 1+1, not N+1
# SELECT * FROM posts WHERE person_id = 1 ORDER BY id LIMIT 1;

Add save_and_open_page helper to IntegrationTest
save_and_open_page is a capybara helper that lets developers inspect the status of the page at any given point in their tests. This change adds save_and_open_page helper support to allow using them from within system tests.

Change devcontainer.json to forward used ports for the project
Currently the generated devcontainer.json file does not forward the ports required for the project, so we might need to manually change it in order to access the project when running via devcontainer. This PR adds the required forwarding for the project by default.

Add node and yarn to devcontainer when creating a project with Javascript
Currently when creating a rails project with javascript (–javascript=esbuild for example) neither node or yarn are added to the devcontainer. This change adds both when needed.

Fix typo in Feature Policy for idle-detection
This change fixes a small typo in feature policy idle-detection and not idle_detection which was leading to this policy not being applied before.

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

Until next time!

Subscribe to get these updates mailed to you.