Upgrading Cucumber and Capybara to the latest versions available for Rails 2

Rails 2-compatible versions of Cucumber, Capybara, and related gems avoid breakage from newer dependencies and Capybara API changes.

Use SSL for Amazon RDS / MySQL (and your Rails app)

Encrypted connections between Rails and Amazon RDS MySQL protect sensitive data in transit. mysql and database.yml can be configured to require SSL end to end.

Heads up: Rails offers two similar means for text truncation

Rails has both truncate helper and String#truncate; the helper is preferred for block support and safer HTML handling, especially with escape: false.

Fix for "Rails assets manifest file not found" in Capistrano deploy

Webpacker-only Rails deploys can fail on deploy:assets:backup_manifest because capistrano-rails expects Sprockets assets. Clearing that task avoids the missing manifest error.

How to avoid ActiveRecord::EnvironmentMismatchError on "rails db:drop"

Rails database tasks can fail with ActiveRecord::EnvironmentMismatchError after restoring a dump from another environment. Updating ar_internal_metadata or disabling the environment check lets rails db:drop proceed.

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.

Rails: Send links in emails with the right protocol

ActionMailer defaults to http in email links, which can expose session cookies to SSL-stripping. Set default_url_options or the link protocol to use https where needed.

Save ActiveRecord models without callbacks or validations (in Rails 2 and Rails 3)

Persist ActiveRecord records directly when callbacks and validations are unnecessary; Rails 2 has create_without_callbacks and update_without_callbacks, while Rails 3 needs sneaky-save.

Rails: Use STI in Migration

ActiveRecord migrations can break when STI models are referenced directly; embedding model classes in the migration and overriding find_sti_class and sti_name keeps type lookup working.

Beware of rails' reverse_order!

reverse_order breaks on complex SQL sorting and can generate invalid queries in Rails 4; Rails 5 raises ActiveRecord::IrreversibleOrderError instead.

Bundler for Rails 2.3.x

Bundler support for Rails 2.3.x requires updated RubyGems and Passenger, a bundled Gemfile workflow, and bundle exec for tests and deployment.

Sprites with Compass

CSS sprites can reduce image requests by bundling small backgrounds into one sprite; Compass and compass-rails automate sprite generation in Rails apps.

Accessing Rails config in webpack(er)

Rails secrets and other configuration values can be read inside webpack bundles with rails-erb-loader, enabling environment-specific client-side settings without hardcoding them.

Heads up! Years are always floats in Rails < 4

1.year returns a Float in Rails < 4 and can break code that expects an integer duration; Rails 4 uses ActiveSupport::Duration instead.

Managing vendor assets in Rails with Bower

Rails asset management becomes easier with bower-rails, using a Bowerfile and rake tasks to install, list, update, and rewrite vendored front-end packages.

Rails routes: Extracting collection actions into their own controllers

Rails routing can make singleton collection pages awkward to place under a namespace without adding :project_id; custom controller paths or namespace/resource combinations keep URLs and controllers aligned.

How to split config/routes.rb in Rails 4

Splitting Rails route definitions across multiple files can improve organization in larger apps. Rails::Engine and config.paths['config/routes.rb'] can load route files from config/routes/.

Structuring Rails applications: the Modular Monorepo Monolith

Monolithic Rails apps can stay maintainable by splitting code into a monorepo of Rails Engines and gems with explicit component dependencies.

Signed URLs with Ruby on Rails

Temporary, tamper-resistant links can be built in Rails without extra database columns or conditional logic by using ActiveRecord's signed_id and .find_signed.

How to fix: WrongScopeError when using rspec_rails with Rails 6.1

rspec_rails with Rails 6.1 can raise WrongScopeError; upgrading the gem to 4.0.1 or later resolves the failure.

Running Rails 2 apps with modern MariaDB SQL server

Rails 2 apps can break on MySQL 5.7; MariaDB 10.x is a compatible replacement for old and new applications, with gem rebuilds sometimes needed after switching.

How to include Sidekiq job IDs in Rails logs

Sidekiq jobs lose request context in Rails logs, making parallel worker output hard to trace. Tagging log lines with worker class and jid keeps job activity readable.

Rails: How to restore a postgres dump from the past

Old PostgreSQL dumps can fail to load when their schema no longer matches the current Rails database; restoring them often requires checking out the migration version used when the dump was created.

Rails 2's CookieStore produces invalid cookie data, causing tests to break

Recent Rails 2 CookieStore versions can emit malformed Set-Cookie headers with blank lines, breaking Cucumber integration tests when cookies are written more than once.