Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of cattr_accessor in ActiveRecord::Base #42451

Merged
merged 4 commits into from
Jun 11, 2021

Conversation

casperisfine
Copy link
Contributor

See #42442 for full context.

In short class variables are slow, particularly in classes with many ancestors, and ActiveRecord::Base has over 60 ancestors.

Only a small handful of these really matter performance wise, however the idea is to migrate them all regardless for consistency and to ensure future contributors will follow the new pattern rather than add new mattr/cattr.

This should be the last ones in ActiveRecord::Base. There are others in other Active Record classes, but since they don't have large ancestor chains, it doesn't matter much.

I'll look at other classes with large ancestors chains instead (ActionController::Base ?)

@byroot byroot merged commit ba4fde3 into rails:main Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants