The Wire · Showcase
Rails Fixes Composite Foreign Key Touch Bug, Solid Cable Drops Ruby 3.1
By RepoJournal · Filed · About Rails
Rails patched a silent failure in composite foreign key associations where touch: true would skip updating the old record when relationships changed.
The composite foreign key fix [1] [2] addresses a real production problem: when a belongs_to with touch: true and composite keys changed targets, only the new associated record got its updated_at timestamp. The old one was silently skipped because the touch_record method was doing a hash lookup with the entire array as key, but saved_changes tracks individual column names. Now each column is checked individually to reconstruct the old composite key. This is a solid catch for anyone using composite foreign keys in associations [3]. Separately, Rails test infrastructure improved with better database cleanup after bin/setup tests [4] [5], preventing stale app_development and app_test databases from polluting the test environment. On the Solid Cable desk, v4.0.0 shipped with breaking changes: Ruby 3.1 and 3.2 support dropped [6], and the library now eagerly initializes last_id to avoid skipping messages on reconnection [6]. If you're running Solid Cable on Ruby 3.1 or 3.2, you're locked to v3.x.
Action items
- → Update Solid Cable to v4.0.0 only if you're on Ruby 3.3+ rails/solid_cable [plan]
- → If using composite foreign keys with touch: true, pull the latest Rails main to get the fix rails/rails [monitor]
- → Check test database cleanup in your CI if you run bin/setup tests rails/rails [monitor]
References
- [1] Merge pull request #57158 from romulostorel/fix-composite-fk-touch-record rails/rails
- [2] Fix touching records via composite foreign keys rails/rails
- [3] Fix touch_record for composite foreign keys ↗ rails/rails
- [4] Merge pull request #57457 from yahonda/yahonda/railties-bin-setup-test-db-cleanup rails/rails
- [5] Drop generated app databases after `test_bin_setup_output` rails/rails
- [6] v4.0.0 ↗ rails/solid_cable
FAQ
- What changed in Rails on May 25, 2026?
- Rails patched a silent failure in composite foreign key associations where touch: true would skip updating the old record when relationships changed.
- What should Rails teams do about it?
- Update Solid Cable to v4.0.0 only if you're on Ruby 3.3+ • If using composite foreign keys with touch: true, pull the latest Rails main to get the fix • Check test database cleanup in your CI if you run bin/setup tests
- Which Rails repositories shipped on May 25, 2026?
- rails/rails, rails/solid_cable