流浪者与Rails服务器共享的文件夹 [英] Vagrant shared folder with rails server

查看:95
本文介绍了流浪者与Rails服务器共享的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个无聊的盒子里的nfs共享文件夹上运行rails.当服务器(瘦/webrick)运行时,我正在编辑主机中的文件.但是我必须继续停止并重新启动应用程序服务器才能看到webapp中反映的更改.这是正常行为吗?

解决方案

我在Vagrant框上遇到此问题,该文件夹将我的文件夹与可以从1.5版开始使用,并且有一些好处,但是对我来说,这是行不通的,因为如果我必须在每个拥有的虚拟机上复制工作区,则空间不足.

I'm running rails on a nfs shared folder in a vagrant box. While the server (thin/webrick) is running I'm editing files in my host. But I have to keep stopping and restarting the application server to see changes reflected in the webapp. Is this normal behaviour?

解决方案

I go this issue on Vagrant box synchronising my folder with NFS.

I made a change in my application development configuration file (config/environments/development.rb), just adding this line config.reload_classes_only_on_change = false and it works.

Ensure that you have this config.cache_classes = false as well, I had it by default when I setup rails application (using version 4.1.5), because where I found that workaround (http://edgeguides.rubyonrails.org/configuring.html) says that config.reload_classes_only_on_chage = false is ignored if config.cache_classes is true

Another solution is use vagrant Rsync synchronise mechanism, which is available from version 1.5 and have some benefits, but for me it doesn't work because I run out of space if I have to make a copy of my workspace on each virtual machine that I have.

这篇关于流浪者与Rails服务器共享的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆