diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-11-18 15:19:15 -0800 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-11-18 15:20:19 -0800 |
commit | 08576b94ad4f19dfc368619d7751e211d23dcad8 (patch) | |
tree | a8be0f668e65f0c90a79cd3031984c507225019c /activerecord/test/cases | |
parent | 78e7a0d3b7eaafe1ad0a45e3e355e1123cae3f8b (diff) | |
download | rails-08576b94ad4f19dfc368619d7751e211d23dcad8.tar.gz rails-08576b94ad4f19dfc368619d7751e211d23dcad8.tar.bz2 rails-08576b94ad4f19dfc368619d7751e211d23dcad8.zip |
Improve the performance of reading attributes
We added a comparison to "id", and call to `self.class.primary_key` a
*lot*. We also have performance hits from `&block` all over the place.
We skip the check in a new method, in order to avoid breaking the
behavior of `read_attribute`
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/inheritance_test.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb index 792950d24d..0338669016 100644 --- a/activerecord/test/cases/inheritance_test.rb +++ b/activerecord/test/cases/inheritance_test.rb @@ -22,7 +22,7 @@ class InheritanceTest < ActiveRecord::TestCase company = Company.first company = company.dup company.extend(Module.new { - def read_attribute(name) + def _read_attribute(name) return ' ' if name == 'type' super end |