Forum: Ruby What's the difference between require and require_dependency

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
dan.bikle (Guest)
on 2005-11-26 00:31
(Received via mailing list)
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.

-Dan
flori (Guest)
on 2005-11-26 01:03
(Received via mailing list)
Dan B. wrote:

>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
schoenm (Guest)
on 2005-11-26 04:20
(Received via mailing list)
> 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).
petermichaux (Guest)
on 2005-12-03 16:59
(Received via mailing list)
can require_dependency be made to reload all of the applicaiton not just
the
things in the app directory? Editing plugin files or css requires
restarting
webrick which is a pain.

-Peter
This topic is locked and can not be replied to.