The Wire · Showcase
RAILS RESTORES ALIAS_ATTRIBUTE IN ASSOCIATIONS, FIXES SILENT FAILURES
By RepoJournal · Filed · About Rails
A performance optimization from Rails 4.2 has been quietly breaking alias_attribute in associations for years, and it's finally fixed.
Rails patched a critical regression where alias_attribute on foreign keys and primary keys was silently ignored during association reads [1]. The culprit: a 2012 switch from the public read_attribute method to an internal _read_attribute fast path that skipped alias resolution entirely. Production apps worked around it without knowing the feature was broken.
Beyond that fix, Rails cleaned up MySQL migration internals by consolidating ALGORITHM and LOCK clauses into a single MySQL::AlterTable state [2], eliminating duplication across add_column, change_column, rename_column, and remove_column. The framework is also deprecating CommandRecorder#record and #inverse_of [3], moving away from Ruby's ruby2_keywords mechanism as that flag itself heads toward deprecation. ActionController::Parameters#deep_transform_keys! now transforms keys in place [4].
On the tooling side, tailwindcss-rails bumped GitHub Actions dependencies [5], a routine maintenance task that keeps CI pipelines current.
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 to latest Rails if you use alias_attribute on foreign or primary keys in associations rails/rails [immediate]
- → Review code calling CommandRecorder#record or #inverse_of directly; these are now private rails/rails [plan]
- → Regenerate GitHub Actions workflows to pick up checkout v7.0.1 if using tailwindcss-rails rails/tailwindcss-rails [monitor]
References
- [1] Restore `alias_attribute` support in associations ↗ rails/rails
- [2] Consolidate MySQL `ALGORITHM` / `LOCK` into `MySQL::AlterTable` state rails/rails
- [3] Make `CommandRecorder#record` and `#inverse_of` private ↗ rails/rails
- [4] Merge pull request #58340 from 55728/remove-unused-deep-transform-keys-bang rails/rails
- [5] build(deps): bump the github-actions group with 3 updates ↗ rails/tailwindcss-rails