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.
Rails asset pipeline: Why relative paths can work in development, but break in production
Relative asset URLs can work in Rails development but break after assets:precompile, because files are merged into public/assets and fingerprinted.
How to make RubyMine aware of Cucumber steps defined in gems
RubyMine can flag Cucumber steps from gems as undefined because external step definitions are not linked by default. Adding the gem under Cucumber settings restores navigation and resolution.
Flexbox: How to prevent <pre> elements from overflowing
pre blocks can break out of nested flex layouts because flex items default to min-width: auto, causing overflowing code boxes and broken layouts.
JavaScript: New Features in ES2021
ES2021 adds safer global string replacement, Promise.any(), logical assignment operators, numeric separators and WeakRef support in modern browsers.
Use DatabaseCleaner with multiple test databases
Rails apps with multiple databases need separate test cleanup, or records bleed between specs and migrations. DatabaseCleaner can target each connection via a model-backed database key.
ActiveRecord: Query Attributes
attribute? often checks presence like attribute.present?, but numeric values and associations behave differently; 0 can be false for ActiveRecord query attributes.
How to bind an event listener only once with Unpoly
Unpoly event listeners can be limited to a single execution with { once: true } or up.off, useful for tests and callbacks that must not repeat.
Gem development: recommended gem metadata
Gem metadata can add source, bug tracker, changelog and MFA links to the RubyGems page, improving discoverability and security signals.
Chrome DevTools: List Registered Event Listeners
Inspect registered DOM event handlers in Chrome DevTools with getEventListeners(object) or the Event Listeners tab when debugging missing or duplicate listeners.
How to get information about a gem (via CLI or at runtime from Ruby)
Need version or install-path details for a Ruby gem? gem info and Gem.loaded_specs provide gem metadata at the command line or during runtime.
RSpec: Expect one of multiple matchers to match
RSpec allows chaining matchers with .or, so an expectation passes when any one matcher matches. Useful for Capybara checks across different button renderings.