Not found

The exact documentation you were looking for could not be found. Here is the best guess.

require_dependency(file_name, message = "No such file to load -- %s.rb") public

Interprets a file using mechanism and marks its defined constants as autoloaded. file_name can be either a string or respond to to_path.

Use this method in code that absolutely needs a certain constant to be defined at that point. A typical use case is to make constant name resolution deterministic for constants with the same relative name in different namespaces whose evaluation would depend on load order otherwise.

Show source
Register or log in to add new notes.
July 4, 2010
4 thanks

Common use

I typically use require_dependency when developing a class or module that resides in my rails app, perhaps in the lib/ dir. A normal require statement does not reload my changes, so I use require_dependency in files that reference my newly developed class or module.