Force reload library files that are required by an autoload library file

Rails 3.2.3 . I have a Rails application with /libat my startups. One of my library files requires a bunch of such files

Dir[Rails.root.join("lib/foo/*.rb")].each { |f| require f }

During development, these files do not reload if I modify them. For example, if I change /lib/foo/bar.rb, I will have to restart the server to see these changes. Can someone suggest a way so that for each request they are restarted properly?

+5
source share
3 answers

If you have these files in the startup path:

config.autoload_paths += %W(#{config.root}/lib)

then you will not need to demand them. Have you tried this ?

+3

require .

require_dependency , , , . , ,

+3

You need to add or comment on the line.

config.autoload_paths + =% W (# {config.root} / lib)

for your Application class in config / application.rb

0
source

All Articles