How can I force my plugin to reload with each request?

后端 未结 6 514
离开以前
离开以前 2020-12-17 14:43

As I understand it, plugins are not reloaded in Rails with each request in development mode. Which makes sense, as generally you add plugins to your app and it\'s the app yo

6条回答
  •  一个人的身影
    2020-12-17 14:50

    I have been struggling with this for some time, too. None of the solutions work, including the autoload_paths and autoload_once_paths tricks. Furthermore, the hack with FileUpdateChecker and initializers also does not help (the checker triggers properly, but the files are not reloaded). Same for config.reload_plugins = true...

    However, there is a solution. In app/controllers/application_controller.rb add one line: require_dependency 'your_file_name_here' The application controller is reloaded on every request and require_dependency makes your file to be checked for modifications and reloaded accordingly. It worked for me, Apache 2, Passenger 3 and Rails 3.0.3.

提交回复
热议问题