diff options
author | Aliaksey Kandratsenka <alk@tut.by> | 2008-10-03 13:40:51 +0300 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-10-04 17:48:13 +0200 |
commit | f550c8625739106e957e4260d3d592a9665fc943 (patch) | |
tree | 3822417cd66dfd4a03f817cdc4e64a4f7062d457 /activerecord | |
parent | 6080b73b1cf6c9ff969b81751a1e5d26d7633a32 (diff) | |
download | rails-f550c8625739106e957e4260d3d592a9665fc943.tar.gz rails-f550c8625739106e957e4260d3d592a9665fc943.tar.bz2 rails-f550c8625739106e957e4260d3d592a9665fc943.zip |
Fix performance bug in AttibuteMethods#respond_to? in handling of private methods
We have hit dramatic increase in tests time after upgrading rails.
Profiling revealed this particular place. After this fix our test times returned
back to norm.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#1173 state:committed]
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index e5486738f0..1c753524de 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -342,7 +342,9 @@ module ActiveRecord method_name = method.to_s if super return true - elsif self.private_methods.include?(method_name) && !include_private_methods + elsif !include_private_methods && super(method, true) + # If we're here than we haven't found among non-private methods + # but found among all methods. Which means that given method is private. return false elsif !self.class.generated_methods? self.class.define_attribute_methods |