This week in Rails covers several notable changes: a fix making add_foreign_key with if_not_exists: true properly reversible in migrations; ActiveJob retry_on now accepting Float values for :wait; a new ActiveSupport::ProxyLogger that forwards logs to another logger at an independent severity level; deprecation of Mime::SET, Mime::LOOKUP, and Mime::EXTENSION_LOOKUP in favor of public API methods; inclusion of call options in Cache#exist? instrumentation payloads; improved PostgreSQL timestamp/time precision reporting in Active Record; and a new product reviews tutorial added to the Rails guides.
Nguồn: https://rubyonrails.org/2026/7/3/this-week-in-rails. 8sync News chỉ tóm tắt và dẫn link; bản quyền nội dung thuộc tác giả và nguồn gốc.
Bài viết hướng dẫn triển khai sáu mẫu thiết kế cổ điển (Factory, Builder, Adapter, Decorator, Proxy, Facade) theo phong cách Ruby, sử dụng các tính năng ngôn ngữ như duck typing, modules, tap và SimpleDelegator để giảm boilerplate. Ruby ưu tiên composition hơn inheritance, điều này thể hiện xuyên suốt các mẫu thiết kế được trình bày.
Lập trình viên Ruby nên đọc bài này để hiểu cách áp dụng các mẫu thiết kế classic theo phong cách Ruby hiện đại, tiết kiệm thời gian và tránh sự phức tạp của các ngôn ngữ khác nhờ sự linh hoạt của duck typing và prefer composition over inheritance.

Thay vì tạo lớp ActiveJob mỏng để gọi phương thức đơn lẻ trong file recurring.yml, lập trình viên Ruby on Rails có thể sử dụng khóa command: để gọi trực tiếp phương thức lớp Ruby thuần. Cách này giảm boilerplate, giữ logic trong đối tượng Ruby thuần, và chỉ cần worker cấu hình cho queue solid_queue_recurring. Có thể ghi đè queue cho mỗi tác vụ.
Lập trình viên Ruby on Rails nên đọc bài này để tiết kiệm thời gian và tránh việc tạo lớp ActiveJob thừa khi chỉ cần xử lý nhiệm vụ định kỳ đơn giản, đồng thời tối ưu hóa cấu trúc mã bằng cách sử dụng Solid Queue một cách hiệu quả.
Bảng tham chiếu tương thích này liệt kê phiên bản JRuby từ 9.2 đến 10.1, bao gồm mức ngôn ngữ Ruby, phiên bản Java tối thiểu và phiên bản Rails hỗ trợ. JRuby 10 cải thiện thời gian khởi động nhờ AppCDS và Project CRaC, trong khi lợi thế của JRuby so với CRuby MRI bao gồm đa luồng thực sự (không có GVL), truy cập hệ sinh thái JVM và triển khai dưới dạng một artifact duy nhất.
Lập trình viên phát triển ứng dụng Rails cần tham khảo bảng so sánh này để chọn phiên bản JRuby phù hợp với yêu cầu Ruby version, Java cốt lõi và Rails version, giúp tối ưu hiệu năng, tương thích và triển khai nhanh chóng.
The Rails Foundation has completed its Learn Rails tutorial series with the final installment: Product Reviews. The series, created in partnership with Chris Oliver, guides beginners through building a real-world e-commerce application step by step. The four tutorials cover creating a store, user authentication and settings, wishlists, and now product reviews. The series aims to teach practical, production-style Rails features to new developers.
Markus Schirp, creator of the mutant gem, discusses mutation testing in Ruby and how it can help verify code correctness — especially relevant as AI-generated code becomes more prevalent. The episode explores how mutation testing works and why it may be a valuable tool for catching bugs that traditional test suites miss.
Hanami 3.0 is released with three major new features: first-class mailers with SMTP support and injectable delivery, built-in i18n with translate/localize helpers across actions and views, and Minitest support alongside the existing RSpec setup. Performance is dramatically improved through default component memoization, yielding nearly 3x HTTP throughput, 14x fewer allocations per request, and p99 latency dropping from 89ms to 4ms. Other highlights include colorized and structured logging, improved asset watching, body parsing moved into Hanami Action, undecorated view exposures by default, gem renames (hanami-controller → hanami-action), retirement of hanami-validations in favor of dry-validation, and a Ruby 3.3 minimum requirement.
A practical guide for engineering leaders inheriting a large Rails monolith, focused on how to triage and prioritize production problems effectively. Key themes include: why the loudest errors in trackers are rarely the most costly, how to surface silent failures (latency, data integrity, developer experience) that never appear in error trackers, and how to build a weighted triage model in Ruby that scores issues across customer, financial, developer, and business dimensions using non-linear severity tiers. The post also covers alert fatigue and normalization of deviance, the clustering of failures in unowned code, and how flipping the axis of ownership tooling (e.g., Packwerk) from consumers to producers makes violations actionable. References Google SRE golden signals, DORA metrics, Accelerate, and Adam Tornhill's code hotspot analysis.
Two Dependabot compatibility issues with Bundler 4 have been resolved via merged fixes in dependabot-core. The first affected Bundler 4.0.0–4.0.10, where Dependabot could strip the CHECKSUMS header from Gemfile.lock, causing CI failures. The second affected Bundler 4.0.11+, where Dependabot regenerated checksums using the latest Bundler version instead of the project's configured version, producing noisy diffs. Both issues are now fixed. Teams using Dependabot with Bundler 4 should update to the latest Dependabot to get cleaner pull requests and predictable lockfile updates.