How to debug issues with zeitwerk and Rails
Zeitwerk autoloading problems in Rails can be hard to trace during boot; Rails.autoloaders.log! and bin/rails zeitwerk:check help reveal constant-to-file mapping issues.
Waiting for page loads and AJAX requests to finish with Capybara
Capybara browser tests can fail while page loads or AJAX requests are still pending; waiting for visible results reduces flickering and unreliable assertions.
Project maintenance: four levels of code quality
Code quality determines maintainability, from merely working code to reliable, readable, and changeable code. Long-lived projects need at least readable code; short-lived code can stop at reliable code.
Rails: Remove Blank Values from Collections
Rails collections often retain empty strings, nil, whitespace, empty arrays, hashes, and false values; compact_blank removes them from arrays and hashes in Rails 6.1+.
Ruby constant lookup: The good, the bad and the ugly
Ruby constant resolution can pick the wrong class through namespace fallbacks, causing autoloading bugs and unexpected references in Rails, especially with nested models.
CSS Support Guide for Email Clients
CSS support in e-mail clients is inconsistent, so HTML email styling often breaks across providers. A compatibility overview helps identify unsafe features before sending.
Postgresql: Paginate and count in one query using window functions
High-latency pagination queries can be reduced to one PostgreSQL statement by using COUNT(*) OVER() to return page rows and total rows together.
JavaScript: Testing whether the browser is online or offline
Browser connectivity can be misleading: navigator.onLine often stays true without usable internet. A real fetch with timeout can confirm whether requests actually work.
How to solve Selenium focus issues
Browser focus loss makes Selenium tests flicker red and green, especially with Firefox and parallel runs. Explicit focus and blur handling and focus-independent tests improve stability.
Squashing several Git commits into a single commit
Combining WIP changes into one clean commit reduces noisy history and simplifies merging feature branches, but rebasing can rewrite or lose commits if done carelessly.
You are not using filter_map often enough
Ruby 2.7 adds filter_map for combining selection and transformation in one pass, avoiding map/compact or select/map chains on any Enumerable.
Josh McArthur: Fancy Postgres indexes with ActiveRecord
Case-insensitive address uniqueness in Rails needs a functional PostgreSQL index and custom model validation when built-in helpers do not support expression-based constraints.
ruby-sass: Do not use comments between selector definitions
Comments between grouped selectors can make ruby-sass drop part of a rule, breaking hover fallback styling. sassc, Node Sass, and Dart Sass are not affected.
Rails: How to find records with empty associations
Find Rails records with no associated rows, such as decks without cards or cards without a deck, using where.missing or left_joins.
Do not forget mailer previews
Mailer previews often break when mailer code changes, and automated checks can catch missing updates before they reach development workflows.
Rails: Default HTTP status codes when redirecting
Redirects in Rails use different default status codes in controllers and routes, and an unintended permanent redirect can affect browser behavior.
Show a JS fiddle in fullscreen
Open a JS Fiddle in fullscreen by appending /show to the URL; the viewer loads the fiddle without the editor chrome.
IRB's multi-line autocomplete and how to disable it
IRB’s multi-line completion can slow down input and make Backspace unreliable; --nomultiline or IRB.conf[:USE_MULTILINE] = false disables it while keeping Tab completion.
makandra_sidekiq 0.2.0 respects the configured Sidekiq timeout
makandra_sidekiq 0.2.0 prevents Sidekiq from killing long-running jobs during shutdown by honoring the configured timeout and allowing jobs to requeue safely.
Capybara: Most okayest helper to download and inspect files
Reliable file-download testing in Capybara, including filename, content type, disposition, and text inspection across Selenium and Rack::Test without leaving the page.
How to quickly inspect an Angular scope in your webkit browser
Chrome and Safari consoles expose the selected DOM node, making Angular scope inspection fast when debugging selected page elements.
net-ssh and openssl-3.0.0
Ruby 3.1 with openssl-3.0.0 can break net-ssh 6.1.0 on Ubuntu 22.04, causing Capistrano deploy failures and signature verification errors.
RSpec: How to turn off partial double verification temporarily
RSpec partial double verification blocks stubbing helper methods that come from Rails controllers; without_partial_double_verification or a spec config can disable it temporarily.
When upgrading/downgrading RubyGems and Bundler on a server, you must clear bundled gems
Changing RubyGems or Bundler versions on servers can leave deployed gems and binstubs incompatible; clearing the shared bundle path forces reinstall and avoids boot failures.