What's the difference between require and require_dependency?

F

Florian Frank

Dan said:
People,
What's the difference between require and require_dependency?

I looked here for clues:
http://www.ruby-doc.org/core/
and I could not find either one.
require loads a file (shared object or ruby source) once from the load path.

require_dependency isn't a ruby core feature, it's part of rails. It
remembers the given
file and loads it on each new server request (like load "path/file.rb"
does), if development mode is enabled:

http://wiki.rubyonrails.com/rails/pages/RequireDependency
 
M

Michael Schoen

What's the difference between require and require_dependency?
I looked here for clues:
http://www.ruby-doc.org/core/
and I could not find either one.

"require" is standard ruby. "require_dependency" is a Rails extension
that works some magic when operating in development mode (in which Rails
reloads most of the app classes with each request).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top