Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

don't eagerload paths that have been flagged as eager_load => false

  • Loading branch information...
commit f6fea0d55366a070009a3a7418e8dd6f8dfb6915 1 parent dbd0b12
@crankharder authored
Showing with 5 additions and 1 deletion.
  1. +1 −1  railties/lib/rails/engine.rb
  2. +4 −0 railties/lib/rails/paths.rb
View
2  railties/lib/rails/engine.rb
@@ -436,7 +436,7 @@ def eager_load!
config.eager_load_paths.each do |load_path|
matcher = /\A#{Regexp.escape(load_path)}\/(.*)\.rb\Z/
Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
- require_dependency file.sub(matcher, '\1')
+ require_dependency file.sub(matcher, '\1') unless config.paths.skip_eager_load.any?{|path| file.match(path)}
end
end
end
View
4 railties/lib/rails/paths.rb
@@ -72,6 +72,10 @@ def autoload_once
filter_by(:autoload_once?)
end
+ def skip_eager_load
+ @skip_eager_load ||= all_paths.select{|path| !path.eager_load?}.flatten
+ end
+
def eager_load
filter_by(:eager_load?)
end
Please sign in to comment.
Something went wrong with that request. Please try again.