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

推荐订阅源

P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
Recent Announcements
Recent Announcements
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
J
Java Code Geeks
博客园_首页
Jina AI
Jina AI
美团技术团队
H
Help Net Security
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
S
SegmentFault 最新的问题

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
Preprocessed Active Storage variants and more
David Heinemeier Hansson · 2023-07-07 · via Ruby on Rails: Compress the complexity of modern web apps

Friday, July 7, 2023
Posted by wojtek

Hi, Wojtek here. Let’s see what changed in the Rails codebase.

Add an option to preprocess Active Storage variants in background job
Active Storage variants are processed on the fly when they are needed but sometimes we’re sure that they are accessed and want to process them upfront.

class User < ApplicationRecord
  has_one_attached :avatar do |attachable|
    attachable.variant :thumb, resize_to_limit: [100, 100], preprocessed: true
  end
end

Introduce sanitizer_vendor config for Action Text
Use Rails::HTML5::SafeListSanitizer by default in the Rails 7.1 configuration if it is supported. Action Text’s sanitizer can be configured by setting config.action_text.sanitizer_vendor.

Improve performance of ActiveSupport::JSON.encode
This about doubles the performance of .to_json/ActiveSupport::JSON.encode. The benchmarks are included in the pull request.

Allow opting in/out of Link preload headers when calling stylesheet_link_tag or javascript_include_tag

# will exclude header, even if setting is enabled:
javascript_include_tag("http://example.com/all.js", preload_links_header: false)

Disable database prepared statements when query logs are enabled
Prepared statements and query logs are incompatible features due to query logs making every query unique so Active Record will create a new prepared statement for each, potentially exhausting system resources.

Fix has_one through singular building with inverse
Allows building of records from an association with a has_one through a singular association with inverse. For belongs_to through associations, linking the foreign key to the primary key model isn’t needed.

Don’t double-encode nested field_id and field_name index
This fixes the bug with adding an extra index parameter in form builder for deeply nested associations.

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

Until next time!

Subscribe to get these updates mailed to you.