Reload rails.root / app / resources / * per request

I have a rails application with a folder rails.root/app/resourceswhere I store some library code. This library code is used in the rack application that I mount in routes.rbin my Rails application

# rails.root/app/resources/file_resource.rb

# routes.rb
mount DAV4Rack::Handler.new(
  :root => Rails.root.to_s,
  :resource_class => FileResource
), :at => '/', :constraints => {:subdomain => "w"}

How can I reload FileResource with every request in development?

I tried autoload_paths, reload_pluginno one works.

I think this has something to do with the code in routes.rb.
If I create a file rails.root/app/resources/my_helper.rband use MyHelper.test () inside FileResource, MyHelper reloads.

No, I do not want to move this to the "lib" folder.

+3
source share
1 answer

, - , , !

# config/environments/development.rb
root = config.root
config.to_prepare do
  load "#{root}/app/resources/file_resource.rb"
end
+2

All Articles