
This week in Rails covers a range of bug fixes and improvements. Key changes include an opt-in for RFC 9110 compliant Accept header content negotiation, dotenv fixes for inline comment stripping and path-based memoization, and several mutation-safety fixes across ActionDispatch, ActiveModel, and ActiveRecord. Association handling improvements cover polymorphic associations with custom primary keys, composite primary key inverse matching, and a new class attribute for primary_key. Ractor safety work continues with frozen defaults and copy-on-write patterns applied to TimeFormats, rescue handlers, parameter encodings, and more. The json gem was bumped to 2.20.0 with comment support enabled, and safe_join's default separator was cleaned up.
Nguồn: https://world.hey.com/this.week.in.rails/rfc-9110-accept-headers-dotenv-fixes-and-ractor-safety-7838327c. 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.

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.
Bài viết cung cấp bảng tham khảo về độ phức tạp thời gian (time complexities) của các thuật toán, thuật toán sắp xếp phổ biến và các thao tác trên cấu trúc dữ liệu thường dùng.
Lập trình viên nên đọc để hiểu rõ cách phân tích hiệu suất thực tế của các thuật toán và cấu trúc dữ liệu, giúp tối ưu hóa mã nguồn và quyết định lựa chọn phù hợp cho từng tình huống xử lý dữ liệu.
Excessive nil pointer checks in Go are often a symptom of poor invariant design rather than good defensive programming. The post distinguishes between legitimate boundary checks (at HTTP handlers, RPC dispatch, queue consumers) and misplaced checks deep in the call stack that silently swallow errors. Using a RateLimiter with a Redis dependency as a running example, it argues that nil dependencies signal construction-time failures that should be handled immediately and loudly, not papered over with guards in inner-layer code. Silent failures are worse than crashes because they delay and obscure the root cause. The recommended approach: validate untrusted input at the outer boundary, establish invariants there, and let inner-layer code trust those guarantees without repeating checks.
Bài viết hướng dẫn chi tiết cách viết Software Design Document (SDD) hiệu quả dựa trên kinh nghiệm từ Google và Microsoft, bao gồm thời điểm viết, mức độ đầu tư, các phần quan trọng (mục tiêu, bối cảnh, SLOs, monitoring, dependencies, security, logging, v.v.), cùng ví dụ thực tế về thiết kế lớp caching. Ngoài ra, tài liệu cũng chia sẻ cách triển khai SDD qua quá trình review nhóm.
Lập trình viên nên đọc bài này để hiểu cách xây dựng tài liệu thiết kế hiệu quả, từ đó tránh rủi ro trong quá trình phát triển phần mềm và cải thiện chất lượng dự án.
A step-by-step guide to migrating a NestJS REST API to tRPC within a pnpm monorepo shared with a Next.js frontend. Covers replacing NestJS controllers with typed tRPC routers using nestjs-trpc, defining Zod input/output schemas, setting up per-request context, implementing protected middleware for auth, generating the AppRouter type via CLI, and wiring up the Next.js client with fully typed hooks. The key benefit demonstrated is compile-time detection of backend-to-frontend type mismatches, eliminating the need for manually maintained type definitions on the client.
A beginner-friendly introduction to type inference for anonymous records, building up from basic record literals to field access, variables, and functions. The post explains why statically typed languages struggle with anonymous records, introduces formal type inference notation with Haskell code examples, and covers two approaches to handling extra record fields: subtyping (as in TypeScript) and row polymorphism (as in PureScript and Elm). Row polymorphism is shown to be more expressive, enabling precise types for operations like record extension. The post is a foundation for a follow-up on type inference for record concatenation in Nix.
Design patterns from the Gang of Four still matter in Ruby, but Ruby's language features change how they're implemented. Duck typing, blocks, modules, and metaprogramming compress many classic patterns into simpler, more idiomatic solutions. For example, the Strategy pattern needs no interfaces or abstract classes in Ruby — duck typing handles it naturally. Blocks replace entire class hierarchies for callbacks, and modules encourage composition over inheritance. The Singleton pattern is built into Ruby's standard library. The key insight is that patterns describe design decisions and shared vocabulary, not specific code templates, so understanding them remains valuable even when Ruby makes the implementations much smaller.