8

Get rid of `cattr_accessor` in `ActiveRecord::Base` by casperisfine · Pull Reque...

 3 years ago
source link: https://github.com/rails/rails/pull/42451
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

casperisfine commented 18 days ago

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 ?)


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK