Rails: Accessing strong parameters

Rails parameters need careful filtering before mass assignment or URL generation; expect, require, permit, slice, and except help avoid security issues and noisy extras.

How to write a good image alt text

Choosing alt text for <img> depends on whether an image is decorative, contains text, or carries meaning in links and buttons.

CSS & a11y: When hiding with opacity, also set visibility:hidden (transitions supported)

Opacity alone hides only visually, leaving elements focusable and exposed to screen readers. Pairing it with visibility:hidden keeps fade transitions smooth and accessibility intact.

Enumerators in Ruby

Ruby each methods can return an enumerator when no block is given, enabling lazy iteration, chaining, and pagination-friendly data fetching.

ActiveSupport includes Timecop-like helpers

Rails test helpers let you freeze or shift time without Timecop; travel_to, travel, and freeze_time simplify time-dependent specs when clock progression does not matter.

Heads up: pg_restore --clean keeps existing tables

pg_restore --clean removes data from dumped tables but leaves extra tables in place, which can break later migrations when restoring a staging dump locally.

Rails 8 introduces `params.expect`

Rails 8 adds params.expect to validate incoming parameters more explicitly, reducing malformed input errors and simplifying strong parameter handling.

Specify Gemfile for bundle

BUNDLE_GEMFILE selects a nondefault Gemfile for Bundler, making it possible to work with multiple Gemfiles in one project and test against different Rails versions.

Rails console tricks

Quick console shortcuts for changing receiver context, inspecting objects, making requests, using helpers, and querying schema in a Rails session.

Does <html> or <body> scroll the page?

Main viewport scrolling in browsers varies between html and body, affecting scrollTop and overflow handling in CSS and JavaScript.

Cucumber features as documentation

Natural-language Cucumber features and scenarios can capture intent and context beyond one-line labels, helping future developers understand application behavior quickly.

An auto-mapper for ARIA labels and BEM classes in Cucumber selectors

Map readable Cucumber locators to CSS via BEM classes or aria-label, so integration tests target page elements without manual selector rules.

Disable automatic code suggestions in RubyMine

Constant code suggestion popups in RubyMine can interrupt typing. Turning off auto-display keeps completion available on demand with Ctrl+Space.

Why am I getting different results working with SVG files and ImageMagick?

SVG rendering with ImageMagick can vary across machines because it may use Inkscape, RSVG, or its internal renderer depending on installed packages.

Git: How to stage hunks with a single key press

Git interactive prompts can accept one-letter answers without Enter, speeding up hunk staging and other review commands.

Building web applications: Beyond the happy path

Web apps fail on devices, browsers, slow networks, large data, and printing when responsive design, loading states, image handling, and metadata are neglected.

How to use html_safe correctly

html_safe marks strings for unescaped insertion in Rails views, but does not unescape content; misusing it on user input can enable XSS.

Rails I18n fallback locales

Reuse one locale as a fallback for another instead of duplicating translations for regional variants like Austrian German.

Unpoly: Showing the better_errors page when Rails raises an error

AJAX errors in Unpoly can hide the full better_errors page in Rails development. A fallback full-page reload restores the interactive error view and CSS.

Sidekiq: Problems and Troubleshooting

Sidekiq workers require thread-safe code; gems used in background jobs must be verified for thread safety to avoid concurrency bugs and crashes.

Caution when using the || operator to set defaults

|| can overwrite valid falsy values like false, 0, and '' when setting defaults; use nil or null checks, fetch, or nullish coalescing instead.

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.

Rails: Reverse Lookup a Fixture Name by it's id and table name

Find a Rails fixture name from a table and numeric id when the record label is unknown. ActiveRecord::FixtureSet can search loaded fixtures and return the matching key.

NPM: How to verify that your package-lock.json fulfills dependencies of package.json

npm clean-install or npm ci validates that package-lock.json matches package.json, preventing silent dependency drift during installation.