Rails Daily

Rails Daily: Composite Key Fixes and Test Coverage Push

Rails developers addressed three critical composite primary key bugs affecting associations and calculations, while a coordinated effort added test coverage for previously untested edge cases across the framework.

Duration: PT2M9S

https://podlog.io/listen/rails-daily-a67c65cf/episode/rails-daily-composite-key-fixes-and-test-coverage-push-277b52e0

Transcript

Good morning, it's June 3rd, 2026. I'm your host with Rails Daily.

The Rails team has been busy fixing composite primary key support, with three significant bug fixes merged yesterday that affect real-world applications using multi-column primary keys.

The most critical fixes center on composite key handling. Pull request 57532 resolved grouped calculations failing when grouping by a belongs-to association with composite keys - previously these would raise an ArgumentError instead of returning results. Pull request 57534 fixed a silent data loss bug where disable-joins through associations would fetch records correctly from the database but then drop them during in-memory grouping, leaving developers with empty results and no error message. A third fix in pull request 57539 ensures that reverse order now properly reverses default ordering instead of discarding it entirely.

Active Storage is getting a major architectural change with pull request 57537, which opens the framework to non-Active Record persistence backends like DynamoDB and MongoDB. This follows discussions at Rails World 2025 and represents a significant shift toward supporting NoSQL databases in Rails core modules.

Meanwhile, contributor hammadxcm has been systematically adding test coverage for edge cases across the framework. Nine pull requests merged yesterday covering everything from out-of-bounds array accessors to mime type predicates and enumerable filtering with nil values. While these don't change production behavior, they strengthen the test suite against regressions in rarely-used code paths.

Two smaller fixes also landed: a touch-later bug that could leak nested association touches to subsequent transactions, and an Action View test case issue where the rendered output wasn't properly reset between test runs.

What's next: These composite key fixes should make Rails more reliable for applications using complex primary key schemes, while the Active Storage persistence changes could open new deployment patterns for teams already using NoSQL databases.

That's your Rails update for today. Stay consistent.