Reputation: 93146
In the Rails guides they have this code to load a path.
$LOAD_PATH << path
ActiveSupport::Dependencies.load_paths << path
ActiveSupport::Dependencies.load_once_paths.delete(path)
The first one I understand. That is for ruby to know where to require files.
But what does the second and the third one means?
Upvotes: 1
Views: 1581
Reputation: 4631
In Rails 3.0 load_once_paths has been renamed to autoload_once_paths and load_paths has been renamed to autoload_once_paths.
Upvotes: 0
Reputation: 13438
Yes, the first line is for Ruby itself (and $:
too). The second one is very similar to the first one, but for ActiveSupport.
load_once_paths An array of paths from which Rails will automatically load from only once. All elements of this array must also be in load_paths.
load_paths An array of additional paths to prepend to the load path. By default, all app, lib, vendor and mock paths are included in this list.
So, if you need to reload your dependencies every new request, don't add them to the one of load_once_paths
directory.
Upvotes: 2