Reloading Rails Directories on Change for Dev: Not Lib!
        Posted  
        
            by yar
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by yar
        
        
        
        Published on 2010-03-15T13:46:35Z
        Indexed on 
            2010/03/15
            14:29 UTC
        
        
        Read the original article
        Hit count: 395
        
ruby-on-rails
|configuration
I have checked out several questions on this, including all of those you see next to the question. Unfortunately, I'm not working with a plugin, and I don't want to work in lib.
I have a directory called File.join(Rails.root, 'classes') and I'd like the classes in this directory to reload automatically in dev. In my environment.rb I have this line
config.load_paths << File.join(Rails.root, 'classes')
which works fine and blows up if the path isn't there. The reloading line in my development.rb also works fine
require_dependency File.join(Rails.root, 'classes', 'blah.rb')
which blows up if the file is not there (a good sign).
However, the file doesn't reload.
This all works if the file is in the root of lib and I use the require_dependency line, but my whole point is to get stuff out of lib as suggested here.
© Stack Overflow or respective owner