A comprehensive tour of 58 built-in Rails features that developers often replace with custom code or third-party gems. Covers ActiveRecord querying tricks (subqueries via select, pick, sole, load_async, strict_loading), model definition helpers (custom attribute types, normalizes, generates_token_for), persistence and callback patterns (after_all_transactions_commit, saved_change_to_*?), ActiveModel form objects, routing tricks (resolve, default_url_options), controller optimizations (ActionController::Metal, rate_limit, params.expect), ActiveSupport utilities (CurrentAttributes, Notifications, MessageVerifier), view helpers, testing time helpers as a Timecop replacement, and console productivity tips. Also flags three 'anti-gems' — Model.suppress, delegate_missing_to, and autosave: true — that look clean but carry hidden footguns.

16m read timeFrom razorjack.net
Post cover image
Table of contents
ActiveRecord – querying #ActiveRecord – model definition #ActiveRecord – persistence & callbacks #ActiveModel #Routing #Controllers #ActiveSupport – core extensions #ActiveSupport – utilities #View helpers #Configuration #Testing #Console & CLI #Turdquoises, or the anti-gems #

Sort: