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.
Ea511be99241b5a6b54bbf6dad4be463?d=identicon&s=25 dan.bikle (Guest)
on 2005-11-25 23: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
D84df7c68f790e492c4ad4ec5fe65547?d=identicon&s=25 flori (Guest)
on 2005-11-26 00:03
(Received via mailing list)
Dan Bikle 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
E75cda3e915fa209386fae3de962cb6a?d=identicon&s=25 schoenm (Guest)
on 2005-11-26 03: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).
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 petermichaux (Guest)
on 2005-12-03 15: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.