How to iterate over all ActiveRecord models

Rails maintenance scripts can loop through every loaded ActiveRecord model for migrations or data fixes. eager_load! and ApplicationRecord.descendants help avoid missing models.

Rails: Join model table migration template

create_join_table builds association tables without ids or timestamps, using foreign keys and optional unique indexes to prevent orphaned or duplicate join records.

Plain CSS does not support variables in media queries (yet)

CSS custom properties cannot be used inside media queries in plain CSS, so responsive breakpoints stay fixed. PostCSS custom media adds reusable query names, but not @container queries.

Working with lists of DOM elements in JavaScript

DOM query results can be live, array-like lists rather than true arrays, and some APIs include text nodes or comments as children.

Fix PNG colors in IE, old Safaris and new Firefoxes

PNG files can show inconsistent colors across browsers because of embedded color profiles and metadata. Converting to a standard profile or stripping PNG chunks improves display consistency.

Git: Show commits that have touched specific text in a file

Find Git commits that changed a specific line or text in a file using git log -G; tig offers a navigable view of matching changes.

RSpec: How to aggregate failures

aggregate_failures in RSpec groups multiple expectation failures in one example, improving test feedback and making debugging mismatched values easier.

Automated "git bisect" will make your day

git bisect run automates regression hunting by repeatedly testing revisions and narrowing down the first bad commit from a command’s exit status.

Webpack(er): A primer

Webpacker integrates webpack with Rails to bundle JavaScript, stylesheets, images, and other assets, with Yarn managing dependencies and loaders handling non-JavaScript files.

Ruby: Using named groups in Regex

Named capture groups make complex regular expressions easier to read and extract values from, with match returning nil on no match and named_captures available in Ruby 2.4+.

Tint and Shade Generator

Simple web tool for creating lighter tints and darker shades from any HEX color value; oklch() can generate them by adjusting lightness.

Git: Finding changes in ALL commits

Git searches are often limited to the current branch, so changes can be missed across other refs, merges, or reflog entries. git log can search broader history with ref and path filters.

RubyMine: Find and Replace with Regex (Capture Groups and Backreferences)

Regex find-and-replace in RubyMine uses capture groups and backreferences to rewrite quoted text, URLs, and old RSpec syntax safely.

Avoid the FLOAT type for database columns

FLOAT can store slightly incorrect values because of precision semantics. DECIMAL offers predictable rounding and overflow behavior for numeric columns.

Using feature flags to stabilize flaky E2E tests

Always-on UI behaviors like polling, animations, autocomplete, and lazy loading can make E2E tests flaky; feature flags disable them by default and re-enable them only where needed.

Migrating from rbenv / nvm to mise

Replacing rbenv and nvm with mise centralizes Ruby and Node version management and avoids shell startup config conflicts during migration.

How to inspect Rails view cache keys (when using Redis)

Rails view fragments cached in Redis are hard to inspect, but Rails.cache.redis.with(&:keys) can list existing keys. Production keyspaces may be very large.

Making minimal updates to DOM trees using morphdom / idiomorph

Replacing DOM fragments with innerHTML wipes state such as form values, scroll position, and custom-element data. morphdom and idiomorph preserve existing nodes by applying minimal changes.

Custom Angular Test Bootstrap

Custom Angular test bootstraps centralize global providers, matchers, and test-wide setup while preserving CLI strict error checking.

Checklist: Using Carrierwave in a Rails project

Checklist for CarrierWave edge cases beyond the default Rails setup: secure URLs, image resizing, metadata handling, file validation, and efficient processing.

Ruby: Do not rescue without specifying exception classes

Bare rescue swallows StandardError and hides typos and other unexpected failures. Rescue only the specific exception you expect so monitoring still catches real bugs.

Jasmine: Cleaning up the DOM after each test

DOM-based Jasmine specs can leak leftover elements into later tests; using a dedicated fixture container cleared after each run keeps test state isolated.

File System Access API: Recursive Directory Traversal

Modern browsers can read selected folders and files with the File System Access API, reducing the need for ZIP upload workarounds when recursive directory handling is enough.

Rails: Adding a unique constraint for a has_one association might be a good default

A unique index on a has_one foreign key lets the database enforce 1:1 relationships and fail fast when application logic creates duplicate rows.