Skip to content

Instantly share code, notes, and snippets.

@cowboycoded
Created April 8, 2011 17:52
Show Gist options
  • Save cowboycoded/910368 to your computer and use it in GitHub Desktop.
Save cowboycoded/910368 to your computer and use it in GitHub Desktop.
dependencies patch
require 'active_support/dependencies'
module ActiveSupport::Dependencies
alias_method :require_or_load_without_multiple, :require_or_load
def require_or_load(file_name, const_path = nil)
if file_name.starts_with?(Rails.root.to_s + '/app')
relative_name = file_name.gsub(Rails.root.to_s, '')
@engine_paths ||= Rails::Application.railties.engines.collect{|engine| engine.config.root.to_s }
@engine_paths.each do |path|
engine_file = File.join(path, relative_name)
require_or_load_without_multiple(engine_file, const_path) if File.file?(engine_file)
end
end
require_or_load_without_multiple(file_name, const_path)
end
end
@jraines
Copy link

jraines commented May 11, 2011

As of Rails 3.1 beta, line 7 should refer to Rails::Application::Railties.engines . . .etc

@cowboycoded
Copy link
Author

Thanks!

@WattsInABox
Copy link

Have you submitted this to Rails as a pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment