diff options
author | José Valim <jose.valim@gmail.com> | 2012-03-12 01:16:19 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2012-03-12 01:16:19 -0700 |
commit | 0533ee45a7a03145d4a37a2b6e3275c6f625a295 (patch) | |
tree | bb484e7384f3dc5c228e3859e7d4878540365ae6 | |
parent | 6c0d5a19a4e97be3d004997f6547ec19e6a22363 (diff) | |
parent | 6b480d2e8260b88474a33f1b45847e0ad8b1bc96 (diff) | |
download | rails-0533ee45a7a03145d4a37a2b6e3275c6f625a295.tar.gz rails-0533ee45a7a03145d4a37a2b6e3275c6f625a295.tar.bz2 rails-0533ee45a7a03145d4a37a2b6e3275c6f625a295.zip |
Merge pull request #5387 from panthomakos/autoload
Improved ActiveSupport::Autoload Performance
-rw-r--r-- | activesupport/lib/active_support/dependencies/autoload.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/dependencies/autoload.rb b/activesupport/lib/active_support/dependencies/autoload.rb index 4c771da096..a1626ebeba 100644 --- a/activesupport/lib/active_support/dependencies/autoload.rb +++ b/activesupport/lib/active_support/dependencies/autoload.rb @@ -9,13 +9,16 @@ module ActiveSupport @@eager_autoload = false def autoload(const_name, path = @@at_path) - full = [self.name, @@under_path, const_name.to_s, path].compact.join("::") - location = path || Inflector.underscore(full) + unless path + full = [name, @@under_path, const_name.to_s, path].compact.join("::") + path = Inflector.underscore(full) + end if @@eager_autoload - @@autoloads[const_name] = location + @@autoloads[const_name] = path end - super const_name, location + + super const_name, path end def autoload_under(path) |