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

推荐订阅源

Last Week in AI
Last Week in AI
U
Unit 42
博客园 - 【当耐特】
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
量子位
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
有赞技术团队
有赞技术团队
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
美团技术团队
雷峰网
雷峰网
小众软件
小众软件
G
Google Developers Blog
GbyAI
GbyAI
Jina AI
Jina AI
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
F
Fortinet All Blogs
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
This Week in Rails: Improve custom namespace autoloading,...
David Heinemeier Hansson · 2023-03-10 · via Ruby on Rails: Compress the complexity of modern web apps

Hi, this is Greg, bringing you the latest changes in the Rails codebase.

Lockdown rails app in production for security
Current Dockerfile generated by Rails runs as a non-root user which prevents modification of the operating system but leaves wide open all gems and the application itself. This change locks down the application gems and only opens up access to the following directories: db, log, storage, tmp.

Improve support for custom namespaces
This patch improves support for custom root namespaces, and consolidates a direction in the design of the integration of Zeitwerk in Rails. There is a great explanation of the why on how on the pull request.

Add class name to ActiveModel::MissingAttributeError error message
When an attribute is missing the previous message was unclear about which class is missing the attribute, especially when there are multiple classes that could miss the attribute. By adding the class name to the error message, debugging is easier.

Fix nullifying association with composite query constraints
Given a models setup like:

class BlogPost < ApplicationRecord
  query_constraints :blog_id, :id

  has_many :comments, query_constraints: [:blog_id, :blog_post_id]
end

class Comment < ApplicationRecord
  query_constraints :blog_id, :blog_post_id

  belongs_to :blog_post, query_constraints: [:blog_id, :blog_post_id]
end

With this change it is now possible to nullify both blog_post.comments = [] and comment.blog_post = nil association which should result in nullification of all parts of the composite query constraints, meaning blog_id and blog_post_id being nil on the affected comments.

Make job display_name failsafe
The display_name method is used by a delayed job to log information about it, including failure messages. Whenever a job class is moved or deleted, the instances still scheduled cannot be constantized anymore, caused display_name and hence the log method to raise an exception. In certain cases, e.g. when logging happens in a rescue block, this may have terminated the entire delayed job worker. With this change, the worker handles failed jobs gracefully and continues work, all with appropriate log output.

Allow both include and where on PostgreSQL add_index
Recently, support was added for the include option when creating an index in PostgreSQL, however, when using this option in conjunction with the where option - the INCLUDE and WHERE segments where in the incorrect order causing the migration to error. This Pull Request changes there order of the INCLUDE and WHERE segments when adding an index so that the query is valid. It also updates the order they are expected in the create index statement when dumping the schema.

Expand rails route search to all table content
This pull request expands the search field on the rails/info/routes page to also search:

  • Route name (with or without a _path and _url extension)
  • HTTP Verb (eg. GET/POST/PUT etc.)
  • Controller#Action

Before this change, the search field was restricted to the route paths.

Enhance has_secure_password to also generate a password_salt method

With this change, has_secure_password generates an #{attribute}_salt method that returns the salt used to compute the password digest. The salt will change whenever the password is changed, so it can be used to create single-use password reset tokens with generates_token_for:

class User < ActiveRecord::Base
  has_secure_password
  generates_token_for :password_reset, expires_in: 15.minutes do
    password_salt&.last(10)
  end
end

Make irb a railties dependency
This pull request adds irb to the dependencies of railties so users with older versions of Ruby can benefit from the latest version of irb, instead of being limited to the version bundled with their Ruby installation.

Implement Object#with
This pull request adds Object#with to set and restore public attributes around a block:

client.timeout # => 5
client.with(timeout: 1) do
  client.timeout # => 1
end
client.timeout # => 5

More examples and details about this change can be found on the pull request.

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

Until next time!

Subscribe to get these updates mailed to you.