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.
Integrating ESLint
JavaScript linting catches style and quality issues early, with a flat config, RSpec check, and gradual cleanup of existing offenses.
How to add esbuild to the rails asset pipeline
Migrating a Rails app from Sprockets-only asset handling to esbuild adds modern JavaScript bundling and can surface path, font, and Sass compatibility issues.
Understanding Ruby's def keyword
Ruby def defines methods, not true nested functions, so method scope and visibility can be confusing for developers coming from other languages.
Regular Expressions: Excessive backtracking can get yourself in trouble
Catastrophic regex backtracking can exhaust CPU and trigger outages from a single pattern. Lazy quantifiers and performance testing help prevent runaway matching.
Terminator setup for Procfile-based applications for more comfortable debugging
Terminator can split Rails debugging into separate panes, keeping the web server and other Procfile processes visible without mixed log output.
esbuild: Make your Rails application show build errors
esbuild watch errors stay hidden in the terminal while Rails keeps serving stale assets; writing them to a file lets the app render build failures in development.
skorks/nesty
Preserve the original failure when re-raising a different Ruby exception so stack traces still point to the root cause; Nesty merges nested errors automatically.
JavaScript Sentry: How to check if errors will be reported
Quickly verify that a JavaScript Sentry setup reports browser errors by triggering a deliberate exception in a click handler.
Trigger a link's click action with Javascript
Programmatically activating a hyperlink can trigger navigation or attached handlers when a user action is unavailable. element.click() performs the same click action on a DOM link.
Browsers will not send a referrer when linking from HTTPS to HTTP
Secure pages linking to insecure destinations suppress the Referer header, making visits appear as direct traffic and breaking source tracking.