开发者

Rails: Mark a class as NOT reloadable

I've got a few classes in lib/ which are not reloadable (due to their internal structure, its a jruby application). How can I tell rails to not reload these after each and every request?开发者_JAVA技巧

Thanks!


After looking at this post about adding reloadability to plugins, I think what you could try doing is adding the file your class resides in to ActiveSupport::Dependencies.load_once_paths

Add something like this in config/environments/development.rb:

ActiveSupport::Dependencies << (Rails.root + "lib/your_class.rb").to_s

The trade off is that you will need to restart your script/server process every time you change one of the files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜