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

推荐订阅源

Last Week in AI
Last Week in AI
H
Help Net Security
博客园 - 叶小钗
V
Visual Studio Blog
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Azure Blog
Microsoft Azure Blog
G
Google Developers Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
GbyAI
GbyAI
Microsoft Security Blog
Microsoft Security Blog
A
About on SuperTechFans
博客园 - 司徒正美
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
月光博客
月光博客
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News

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
Strict template locals, detecting unused routes and an im...
David Heinemeier Hansson · 2022-08-05 · via Ruby on Rails: Compress the complexity of modern web apps

Hi, Petrik here with some updates on activities in Rails and associated projects over the last week.

Allow templates to set strict locals

By default, templates will accept any locals as keyword arguments. To define what locals a template accepts, add a locals magic comment:

<%# locals: (message:) -%>
<%= message %>

Try to find a second time if find_or_create_by hits a uniqueness constraint For the case where most of the time the record is expected to exist, find_or_create_by can be made race-condition free by re-trying the find if the create failed with ActiveRecord::RecordNotUnique. This assumes that the table has the proper uniqueness constraints, if not, find_or_create_by will still lead to duplicated records.

Add support for if_exists option when removing a check constraint 

The remove_check_constraint method now accepts an if_exists option. If set to true an error won’t be raised if the check constraint doesn’t exist.

Add linter for CHANGELOG formatting A PR to Rails should include a CHANGELOG entry if you’re adding or removing a feature, committing a bug fix, or adding deprecation notices. To prevent inconsistencies in the CHANGELOG a linter has been added.

Add drop_enum migration command for PostgreSQL This does the inverse of create_enum. Before dropping an enum, ensure you have dropped columns that depend on it. Update the existing Kindle version of the guide from .mobi to .epub As Kindle is discontinuing support for the .mobi format, this makes the guides available as .epub.

Add –unused option to the routes command to detect extraneous routes

Over time, a Rails app can become slow to boot simply because of how many routes it has. This new option for the routes command can be used to detect routes that are drawn, but aren’t actually valid.

24 people contributed to Rails since the last time.

Lots of activity in the Hotwired world this week as well.

Release Turbo v7.2.0-beta.2 This builds on the v7.2.0-beta.1 release that saw substantial new features and bugs fixes.

Introduce_ turbo:frame-missing_ event

When a response from within a frame is missing a matching frame, the turbo:frame-missing event is fired. For example, if the reason the frame is missing is access (an expired session, for example), the call to visit() can be made with { action: “replace” } to remove the current page from Turbo’s page history.

Activate <script> in Turbo Streams

When a <turbo-stream> element connects to the document, all included <script> elements will be activated.

Preserve <select> values in cache

This change will save the values of <select> tags when creating a snapshot so that when you navigate back or forward in history, form fields will not be reset.

That’s it for this week. Until next time!