Merging two arbitrary ActiveRecord scopes
Rails ActiveRecord::Relation#merge can silently drop conditions on the same column; a subquery keeps combined scopes unambiguous.
Testing if two date ranges overlap in Ruby or Rails
Date and time interval checks are easy to get wrong because partial, nested, and touching ranges all count as overlaps. A simple inclusive comparison works for Ruby and Rails.
Zeitwerk: How to collapse folders in Rails
Rails can keep subfolders for organization without turning them into namespaces; collapse lets nested files define top-level constants instead of modules.
How to: Upgrade CarrierWave to 3.x
CarrierWave 3.x changes upload allowlists, inactive versions, version recreation, and processing paths, breaking older uploader logic and custom transcoders.
Google Chrome: How to restore the old downloads bar
Chrome's old downloads bar offers faster access, visible progress, single-click opening, and easier drag-and-drop reuploads than the newer downloads dropdown.
Delivering Carrierwave attachments to authorized users only
Sensitive file attachments can be restricted to authorized users, or served from hashed public paths and expiring URLs for safer access without exposing direct storage locations.
Geordi hints
Quick Geordi command shortcuts for guided deployment, setup, security updates, tracker-based commits, and matching ChromeDriver installation.
Regular Expressions: Space Separators
\s misses non-breaking spaces in UTF-8 text; [[:space:]] and \p{Zs} match space separators more reliably, with encoding compatibility caveats.
Solving "TypeError (nil can't be coerced into Integer)" in the Rails console / IRB
Rails console assignments can print TypeError (nil can't be coerced into Integer) even when they succeed. The bug affects IRB with --nomultiline and is fixed in reline 0.2.0.
PSA: Be super careful with complex `eager_load` or `includes` queries
eager_load and includes can explode 1-n association queries into huge cross products, wasting memory. preload uses separate queries and avoids the row multiplication.
Ruby: `extend` extends the singleton class's inheritance chain
extend places module methods into a singleton class’s ancestor chain, which affects class methods, method lookup, and super behavior.
Debug MiniMagick calls in your Rails app
CarrierWave hides MiniMagick processing failures behind a generic error; enabling MiniMagick.logger.level = Logger::DEBUG reveals the underlying ImageMagick commands and helps trace the cause.
Heads Up: Selenium 4 uses a binary to determine the chromedriver
Selenium WebDriver 4 can pick an incompatible browser binary in CI, breaking feature tests when Chromium and Chrome versions differ. Setting binary avoids selenium-manager selecting or downloading the wrong browser.
Heads up: Quering array columns only matches equally sorted arrays
PostgreSQL array queries in Rails match element order, so [16, 17] and [17, 16] are different. Order-independent matching needs normalization or bidirectional containment.
Ensure passing Jasmine specs from your Ruby E2E tests
Run Jasmine specs through Rails E2E tests to catch JavaScript failures in regular test runs and verify the runner finishes with all specs passing.
Things you probably didn’t know you could do with Chrome’s Developer Console
Useful Chrome DevTools console tricks for editing pages, timing code, inspecting elements, and reusing previous results.
Preventing users from uploading malicious content
Uploaded HTML or SVG can execute JavaScript and steal session cookies; safer uploads rely on extension allowlists, strict CSP, attachment disposition, or octet-stream delivery.
Parallelize Development Using Git Worktrees
Use git worktree to keep multiple working trees on one repository, so you can test, compare versions, and switch branches without disturbing current work.
Carrierwave: Deleting files outside of forms
Removing CarrierWave attachments outside forms can affect the database and file storage differently. update!(remove_avatar: true) matches normal form behavior and is usually the safest choice.
Use Time.current / Date.current / DateTime.current on projects that have a time zone
Time zone-aware projects need Time.current, Date.current, and DateTime.current so values persist correctly; Time.now can write timestamps with the wrong zone.
RSpec: Leverage the power of Capybara Finders and Matchers for view specs
View specs can stay fast and readable by querying rendered HTML with Capybara finders and matchers instead of relying on heavier request or feature specs.
RSpec: Ensuring a method is called on an object that will be created in the future
RSpec’s and_wrap_original can attach expectations to objects created during a call, making it easier to verify the right validator instance without relying on expect_any_instance_of.
Whenever: Don't forget leading zeros for hours!
Whenever can misread 24-hour times without a leading zero, turning 3:00 into 3pm instead of 3am. chronic_options can switch parsing to a 24-hour clock.
Heads up: RSpec's diffs may not tell the truth
RSpec diffs can mislead when matchers print like failures or when Time.now values differ only by milliseconds.