Generating an Entity Relationship Diagram for your Rails application
Rails apps can generate entity relationship diagrams to visualize model dependencies and export them as images or PDF. rails-erd also supports limiting the diagram to selected models.
Handling NULL values in SQL comparison logic
NULL values break ordinary equality and negation checks in SQL, so rows can disappear unless queries handle unknowns explicitly with IS NULL, IS DISTINCT FROM, or COALESCE.
Deployment: Merge consecutive commits without cherry-picking
Skip unready commits during deployment by merging an earlier commit reference instead of cherry-picking, avoiding duplicate history entries later.
Using ngrok for exposing your development server to the internet
Temporary public access to a localhost development server is useful for testing on another device or through TLS without port forwarding or self-signed certificates.
Logic of `where.not` with multiple attributes
where.not with multiple hash attributes uses NAND logic, excluding only records that match all conditions; chained calls behave like NOR and exclude matches to any condition.
RSpec: Defining negated matchers
RSpec::Matchers.define_negated_matcher creates readable inverse matchers for composed expectations and clearer failure messages, but only for atomic matchers with unambiguous negation.
Caching in Rails < 6.1 may down parts of your application when using public cache control
Public cache control can serve the wrong MIME type and enable cache poisoning when responses vary by Accept; Vary: Accept prevents stale or mismatched cached content.
ES6 imports are hoisted to the top
ES modules are hoisted, so import order in source can differ from execution order and break code that depends on globals like $.
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.
Using feature flags to stabilize flaky E2E tests
Always-on UI behaviors like polling, animations, autocomplete, and lazy loading can make E2E tests flaky; feature flags disable them by default and re-enable them only where needed.
RSpec: automatic creation of VCR cassettes
RSpec examples tagged :vcr automatically record and replay HTTP cassettes, while untagged specs block network calls unless HTTP access is explicitly enabled.
Better numeric inputs in desktop browsers
Desktop number fields accept scientific notation, arrow-key changes, wheel scrolling, and stray letters, causing accidental edits and validation errors.
Event delegation (without jQuery)
Single-listener event handling can cut setup cost and support dynamically added elements, but it can slow fast events and limits bubbling control.
Capybara can find links and fields by their [aria-label]
Capybara can locate form fields and links by aria-label, improving accessibility-aware test selectors when visible labels are missing.
Git shortcut to fixup a recent commit
git commit --fixup needs a target commit SHA, making fixup commits awkward to create; an fzf alias can select the commit interactively before git rebase -i --autosquash.
Working on the Linux command line: How to efficiently navigate up
Frequent upward directory changes in deeply nested trees are slow; shell aliases like .. and ... make jumping to parent folders faster.
You should probably load your JavaScript with <script defer>
Loading JavaScript with defer avoids blocking rendering, runs after parsing, and still before DOMContentLoaded, making it the safer default for head scripts.
NVM: How to automatically switch version when changing directories
Node.js version switching in Bash is manual by default, so projects with .nvmrc can run the wrong runtime until nvm use is triggered automatically.
Accessing JavaScript objects from Capybara/Selenium
Capybara and Selenium can access only browser globals, so exported JavaScript modules fail in evaluate_script unless the component instance is attached to the element.
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.
Carrierwave: How to remove container directories when deleting a record
Deleting uploaded files in Rails leaves empty CarrierWave folders behind; a cleanup hook can remove empty parent directories after record deletion.
Clean code: Avoiding short versions in command options
Shared command examples are easier to read and search when options are written out instead of shortened to cryptic flags.
How to push to Git without running CI on GitLab CI, GitHub Actions, or Travis CI
Git pushes can trigger unwanted CI jobs on GitLab, GitHub Actions, or Travis CI. Skip runs with commit-message flags or GitLab push options.
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.