diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-12-22 16:38:38 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-12-22 16:38:38 -0700 |
commit | be2b98b4ae3397149b713b774e415143c88c4fb7 (patch) | |
tree | 36e3f186761cc67b5ca3fcdd9966404a4847ed4b /activerecord/lib/active_record/readonly_attributes.rb | |
parent | fb160f6e7d71ece0369c6ba9a011ed060f2dcbcb (diff) | |
download | rails-be2b98b4ae3397149b713b774e415143c88c4fb7.tar.gz rails-be2b98b4ae3397149b713b774e415143c88c4fb7.tar.bz2 rails-be2b98b4ae3397149b713b774e415143c88c4fb7.zip |
Improve the performance of reading belongs_to associations
`ActiveRecord::Base#[]` has overhead that was introduced in 4.2. The
`foo["id"]` working with PKs other than ID isn't really a case that we
want to support publicly, but deprecating was painful enough that we
avoid it. `_read_attribute` was introduced as the faster alternative for
use internally. By using that, we can save a lot of overhead. We also
save some overhead by reading the attribute one fewer times in
`stale_state`.
Fixes #18151
Diffstat (limited to 'activerecord/lib/active_record/readonly_attributes.rb')
0 files changed, 0 insertions, 0 deletions