The Wire · Showcase
RAILS TIGHTENS UUID VALIDATION, OPENS API-ONLY STORAGE
By RepoJournal · Filed · About Rails
PostgreSQL adapter now rejects malformed UUIDs that Rails was silently fixing, while Active Storage gains flexibility for API-only applications.
The PostgreSQL adapter caught a subtle bug where trailing dashes in UUIDs were being stripped automatically, masking invalid data at the application layer [1]. This fix ensures User.find('a0eebc999c0b4ef8bb6d6bb9bd380a11-') raises NotFound as expected, closing a validation gap that could hide data integrity issues in production. Meanwhile, Active Storage's base controller is now configurable, letting API-only apps inherit from ActionController::API instead of the default ActionController::Base [2]—a small change with real implications for Rails apps serving only JSON. The role-switching API got a cleanup too, moving prevent_writes configuration to method parameters for clearer semantics [3]. Test infrastructure improvements continue across the framework with more activerecord tests adopting notification assertions [4], reducing boilerplate and making the test suite easier to maintain.
One email a day. Unsubscribe in one click.
Keep up with Rails in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Upgrade Rails and audit UUID handling in your PostgreSQL queries—especially anywhere you're accepting user-provided identifiers rails/rails [plan]
- → If you're running an API-only Rails app with Active Storage, test the new base controller configuration in your staging environment rails/rails [monitor]
References
- [1] Reject trailing dash in PostgreSQL adapter rails/rails
- [2] Allow configuring Active Storage base controller parent class ↗ rails/rails
- [3] Move `prevent_writes` defaulting to params of role switching methods ↗ rails/rails
- [4] Simplify more `activerecord` tests with `NotificationAssertions` helpers ↗ rails/rails