Rails: Fixing ETags that never match

Rails default ETags often never repeat because rotating CSRF tokens and CSP nonces change response bytes, blocking cache hits and 304 responses.

How to make changes to a Ruby gem (as a Rails developer)

Ruby gems need manual file loading, multi-version support, and their own release workflow, unlike Rails apps. Safe changes depend on understanding structure, tests, versioning, and packaging.

How to negate scope conditions in Rails

Finding the opposite of an ActiveRecord scope is tricky with NULL values and older Rails versions; invert_where, subqueries, or Arel can negate conditions safely.

Rails: How to write custom email interceptors

Global mail interception in Rails can prefix subjects by environment and redirect staging mail to a fallback address unless recipients are allowlisted.

A very compatible default CSP for Rails projects

Keep Rails apps protected with a minimally restrictive Content Security Policy that blocks injected scripts while preserving compatibility with nonces and strict-dynamic.

Tracking External API Performance in Rails Logs

Track time, call counts, and token usage for slow external APIs in Rails logs and Server Timing, making LLM regressions and prompt bloat visible without a debugger.

A restrictive (but still practicable) CSP for Rails projects

A strict Content Security Policy for Rails limits scripts to nonce-approved sources while keeping styles, images, forms, and fonts workable.

Custom error pages in Rails

Custom Rails error pages can be rendered through controllers instead of static public files, allowing layouts, helpers, and tests for 404 and 500 responses.

Common mistakes when storing file uploads with Rails

File uploads in Rails are easy to misconfigure, causing lost files, public exposure of confidential data, and environment collisions. Existing uploads also need migration when storage paths change.

Using partials in Rails views

Rails partials support locals, yield, layouts, collections, empty states, controller rendering, and cached collection rendering for reusable view markup.

Best practices: Writing a Rails script (and how to test it)

Rails one-off scripts need idempotence, transactions, transparency, and robust error handling; isolating logic from input also makes them testable.

Rails: Including HTML in your i18n locales

Rails t automatically marks _html translations as HTML-safe, allowing intentional links and formatting while still escaping unsafe interpolations.

Unpoly + Nested attributes in Rails: A short overview of different approaches

Rails nested attributes become cumbersome with dynamic subrecords; Unpoly enables friendlier add/remove workflows without losing server-side validation and form helpers.

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.

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.

Rails: How to get the ordered list of used middlewares

rake middleware reveals the ordered Rails request stack, useful for adding, removing, or profiling middleware that runs on every request.

Rails: Do not load frameworks you don't need

Loading every Rails framework increases startup time and memory use; disabling unused railties and gems keeps apps lighter and avoids unnecessary configuration.

Rails: Using custom config files with the config_for method

Global Rails settings can live in YAML files with environment-specific overrides via config_for, avoiding constant collisions and supporting fetch or bang accessors.

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.

Testing if two date ranges overlap in Ruby or Rails

Date and time interval checks are easy to get wrong because partial, nested, and touching ranges all count as overlaps. A simple inclusive comparison works for Ruby and Rails.

Rails route namespacing (in different flavors)

Rails routes can separate URL segments, helper names, and controller modules, letting you namespace controllers or change paths without affecting the other dimensions.

Overview of method delegation in Rails

Forwarding methods in Rails reduces deep call chains and boilerplate when exposing data from associated objects or decorators.

How to organize large I18n dictionaries in Ruby on Rails

Rails can split large translation files across config/locales to keep model, view, and boilerplate strings manageable.

How to write complex migrations in Rails

Complex Rails schema changes need SQL, embedded migration models, or adapter helpers when simple add_column and update calls cannot handle existing data safely.