betweenGo

Difference between require and require_dependency

by Frank Kim on Mar.29, 2008, under Ruby on Rails

I was wondering what the difference was between require and require_dependency.

According to this post in comp.lang.ruby the difference is not significant but interesting. Looks like I’ll be using require_dependency from now on.

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


Florian Frank


  • Share/Bookmark

Related posts:

  1. optional require in .emacs
  2. Upgrading to Rails 1.0
  3. ruby: no such file to load — ubygems (LoadError)
  4. MeetingKoreans.com launched using Ruby on Rails
  5. Installing Ruby on Rails on Red Hat Enterprise Linux 4

:

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!