Skip to content

Instantly share code, notes, and snippets.

@cowboycoded
Created April 8, 2011 17:48
Show Gist options
  • Save cowboycoded/910361 to your computer and use it in GitHub Desktop.
Save cowboycoded/910361 to your computer and use it in GitHub Desktop.
eager_load! method
#/railties-3.0.5/lib/rails/engine.rb
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')
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment