Bash: How to grep logs for a pattern and expand it to the full request

Find all Rails log lines for matching requests by extracting request IDs and re-grepping the full log, avoiding interwoven output from concurrent requests.

How to enable SSL in development with Passenger standalone

Local Rails development can serve both HTTP and HTTPS with Passenger standalone by enabling SSL and using a self-signed certificate.

An incomplete guide to migrate a Rails application from paperclip to carrierwave

Rails file storage migration with background jobs, reruns, and URL rewrites; large media backfills need careful testing, queue tuning, and fallback handling.

When Date.today and Date.tomorrow return the same day...

Date.today and Date.tomorrow can return the same day when Rails has no configured time zone, causing date handling to drift between UTC and local time.

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.

Capistrano + Rails: Tagging production deploys

Production releases can be linked to Git history by tagging the deployed revision automatically with Capistrano.

Don't use log level :debug in your production environments

log_level :debug can expose sensitive user data in Rails production logs, especially in SQL queries. Use :info, avoid SQL logging, and ensure filtered attributes are applied.

Organizing custom Date(Time) formats

Large Rails projects often duplicate date and datetime format strings, causing inconsistent output; named formats in Time::DATE_FORMATS and Date::DATE_FORMATS reduce repetition.

RSpec: how to prevent the Rails debug page if you want to actually test for 404s

Rails development and test environments often replace real 404s with the debug page, which can hide authorization failures in request specs.

Rails: How to check if a certain validation failed

Find out whether a Rails validation failed by checking ActiveModel::Errors types instead of messages, which is useful in tests and for validations with extra options.

Rails: Output helpers for migrations

Migration output can report progress while batch-updating records with announce and say_with_time in Rails 3.1+.

Cast an ActiveRecord to a subclass or superclass

becomes casts an ActiveRecord record to a different STI class so Rails can treat it as another type, while both instances share the same attributes.

Rails: Accessing helper methods from a controller

Controllers can call view helpers in Rails 5+ through helpers, while older Rails versions use view_context to reach methods like link_to.

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.

Accept nested attributes for a record that is not an association

Pass nested form data to a plain model reader such as home_page, without a real association. Works for singular references, with manual record construction and no deletion support.

Testing ActiveJob `limits_concurrency` with Solid Queue

ActiveJob concurrency checks can pass falsely with the :test adapter because blocked jobs still enqueue; using :solid_queue verifies real blocking behavior.

Ruby and Rails: Debugging a Memory Leak

Growing memory usage in Ruby and Rails can exhaust a process and cause crashes; ObjectSpace.count_objects helps identify leaking object types, and derailed_benchmarks can aid diagnosis.

Rails routing: Using constraints to avoid "Missing template" errors

Route constraints prevent ActionView::MissingTemplate errors on wrong requests by returning 404s instead of reaching an unmatched format or template lookup.

RSpec: How to turn off partial double verification temporarily

RSpec partial double verification blocks stubbing helper methods that come from Rails controllers; without_partial_double_verification or a spec config can disable it temporarily.

Some tips for upgrading Bootstrap from 3 to 4

Migrating a larger Rails app from Bootstrap 3 to 4 often breaks styles, components and helper gems; planning library upgrades and rebuilding variables reduces the pain.

Upgrade guide for moving a Rails app from Webpack 3 to Webpack 4

Webpacker 4 and Babel 7 change config files, package names, asset paths, and polyfill imports when upgrading a Rails app from Webpack 3.

Mailcatcher: An alternative to inaction_mailer

Local email capture for Rails development avoids lost test messages and lets sent mail be viewed in a browser via MailCatcher.

Strict Loading Associations can prevent n+1 queries

Rails 6.1 strict loading prevents lazy association loading and raises errors when unread associations are accessed, helping avoid n+1 queries.

Disable PostgreSQL's Write-Ahead Log to speed up tests

Unlogged PostgreSQL tables can speed up Rails test suites by skipping the write-ahead log, but they raise crash-related data loss risk and stay unsuitable for production.