简体   繁体   English

Ruby on Rails,如何为lib文件夹设置热插拔?

[英]Ruby on Rails, how to setup hot swap for lib folder?

My models are becoming bigger and bigger (fat model thin controller approach) so I am making more and more modules (eg /lib/user/*). 我的模型越来越大(胖模型瘦控制器方法),所以我制作了越来越多的模块(例如/ lib / user / *)。

Problem is that they don't get re-deployed so each time I have to restart Webrick. 问题在于它们不会被重新部署,因此每次我必须重新启动Webrick时。

How to set "hot swap" for lib folder? 如何为lib文件夹设置“热插拔”?

Thank you, and generally is that good practice since it is not enabled by default. 谢谢,通常是一种好的做法,因为默认情况下未启用它。

Use Guard and Guard-Rails . 使用GuardGuard-Rails Guard allows watching of files/folders and taking actions. Guard允许监视文件/文件夹并采取措施。 Guard-Rails will restart your rails server each time a particular file is changed. 每当更改特定文件时, Guard-Rails都会重新启动Guard-Rails服务器。 The default folders for Guard-Rails includes the lib folder (and subfolders). Guard-Rails的默认文件夹包括lib文件夹(和子文件夹)。

You can find details for Guard on github . 您可以在github上找到Guard的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM