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.
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.
Before you make a merge request: Checklist for common mistakes
Merge requests are often rejected for avoidable issues: missing tests, debug code, UI defects, slow queries, missing indexes, or incomplete database changes.
Thread-safe collections in Ruby
Shared data in threaded Ruby code needs protection or immutability; concurrent-ruby offers thread-safe Array and Hash, and Hamster uses immutable collections.
JavaScript: Working with Query Parameters
Query strings are easier to read and modify with URLSearchParams; it parses, updates, removes, and checks parameters across modern browsers, except IE 11.
ActionMailer: Previewing mails directly in your email client
Inspect Rails emails in a real mail app by exporting a Mail::Message to .eml and opening it, instead of relying only on browser previews.
Jasmine: Fixing common errors during initialization
Jasmine boot failures can stem from browser/module detection issues, causing jasmineRequire or getJasmineRequireObj() errors in Webpacker and esbuild setups.
Components: Dynamically growing input field's height to fit content
Auto-growing text inputs need a textarea-based workaround because normal inputs cannot wrap; autosize makes the field expand and shrink with its content.
Casting ActiveRecord scopes or instances to ActiveType extended model classes
Cast ActiveRecord instances or relations to ActiveType::Record subclasses for safer behavior than ActiveRecord#becomes and consistent typed access.
Jasmine: Testing if two arrays contain the same elements
Array comparisons in Jasmine need different matchers for exact order, unordered equality, or subset checks when testing collections.
Version 5 of the Ruby Redis gem removes Redis.current
Redis.current is removed in redis-rb 5.0; code using shared clients needs a replacement pattern for per-use, test, or threaded access.
Carrierwave: How to attach files in tests
CarrierWave uploads in tests often fail with multipart and file-assignment errors; common Rails and RSpec patterns attach fixtures with Rack::Test::UploadedFile, file_fixture, or attach_file.
How to access Chrome Devtools when running JavaScript tests via CLI
Running JavaScript tests from the CLI bypasses browser DevTools, so debugger statements are ignored. node --inspect-brk lets Chrome DevTools attach to Jest and pause execution.
Jest: How to clear the cache
Stale Jest cache can make tests reference refactored code that no longer exists; clearing it with npx jest --clearCache resolves the mismatch.
RSpec: You can super into parent "let" definitions
let can call super() in nested RSpec contexts to reuse parent test data and override one field, but heavy use can make specs harder to read.
Recommended Git workflow for feature branches
Git feature branches stay clean by using WIP commits, frequent rebases onto master, and interactive cleanup before fast-forward merging.