TestProf II: Factory therapy for your Ruby tests—Martian Chronicles, Evil Martians’ team blog
Factories can make Ruby test suites slow by creating large association cascades and redundant records. TestProf helps identify factory hotspots with reports and flamegraphs.
Fragment Caching in Rails 7.1+ requires Haml 6
Rails 7.1 changes fragment cache behavior, breaking Haml 5 buffer patches in apps that use caching. Upgrading to Haml 6 is needed for Rails 7.1+ with fragment caching.
Text fragments in the browser URI fragment
URL text fragments let browsers deep-link to specific visible text without IDs, enabling highlighted shared links to arbitrary content.
How to enable pretty IRB inspection for your Ruby class
Custom Ruby objects can gain colored, multiline IRB output by defining pretty_print; pretty_inspect is a simpler fallback when pretty printing is not needed.
Generating an Entity Relationship Diagram for your Rails application
Rails apps can generate entity relationship diagrams to visualize model dependencies and export them as images or PDF. rails-erd also supports limiting the diagram to selected models.
Custom error messages in RSpec or Cucumber steps
RSpec and Cucumber expectations can emit clearer failure messages, making test failures easier to diagnose when matching conditions or subsets of data do not behave as expected.
Heads up: Counting may be slow in PostgreSQL
COUNT queries can be unexpectedly slow in PostgreSQL; any? and none? check for presence or absence without scanning for a full count.
Debugging Capistrano
Capistrano 3’s doctor task checks Ruby, Rubygems and Bundler versions, installed Capistrano gems, config variables and server settings.
Rails 7 adds #caching? and #uncacheable!
Rails 7 fragment caching gets #caching? and #uncacheable! to detect cache context and prevent accidental caching of helpers or partials that must stay dynamic.
Enabling YJIT
Ruby's JIT compiler needs a YJIT-enabled build and explicit activation; Rails 7.2+ enables it after boot, usually making it active already.
Running Rubocop as a pre-push hook
A pre-push Git hook can block pushes when RuboCop finds style or linting issues, and cached runs are much faster after the first check.
DB enums are ordered
PostgreSQL enums keep a defined sort order, unlike string-backed columns whose collation can produce surprising results. Ordered enum values make priority fields behave predictably.
Switching the package manager from yarn to npm
Migrating a Rails app from yarn to npm can reduce dependency complexity and avoids upgrading to Yarn 2.0. Matching package versions helps keep installs stable.
How to eager load a single directory with Zeitwerk
Zeitwerk can eager load a single subdirectory so descendant classes are available for iteration, while avoiding manual require of the parent file.
jeremyevans/ruby-warning: Add custom processing for warnings
ruby-warning customizes Ruby warning handling, letting specific messages or paths be ignored, warnings turned into errors, backtraces attached, and duplicates removed.
CSS: Matching against attributes and their values (or parts of them)
CSS attribute selectors can target partial values, letting links, classes, and other attributes be styled by prefixes, suffixes, substrings, or whitespace-separated tokens.
JavaScript: Calling a function with a variable number of arguments
Passing an array as separate arguments avoids treating the whole array as a single value; ES6 ... and ES5 apply spread elements into a function call.
Rails: Using normalizes without copying code
Rails 7.1 input cleanup can be reused across models by replacing inline lambdas with callable normalizer classes and a shared base interface.
Carrierwave: How to remove container directories when deleting a record
Deleting uploaded files in Rails leaves empty CarrierWave folders behind; a cleanup hook can remove empty parent directories after record deletion.
SameSite cookies
Browser defaults are shifting toward SameSite=Lax, making cross-site cookie behavior stricter and exposing iframe, API, and non-GET request flows that need SameSite=None or Strict.
How to update the bundler version in a Gemfile.lock
Bundler versions in Gemfile.lock can lag behind the installed release and break compatibility with older Ruby or Rails setups. Updating bundler and regenerating the lockfile keeps BUNDLED WITH aligned.
Designing HTML emails
Email client rendering is inconsistent, so HTML messages need table-based layouts, inline styles, and client-specific workarounds to remain readable across major mail apps.
Project management best practices: Working with clients in person
Regular in-person contact can strengthen collaboration with clients or external product managers and make difficult project discussions easier.
It's OK to put block elements inside an <a> tag
HTML5 allows an <a> tag to wrap block content like paragraphs, lists, and sections, making whole regions clickable without invalid markup.