简体   繁体   English

杂种没有检测到Rails类的更改?

[英]Mongrel not detecting changes in Rails classes?

I have a Rails app installed on a Slicehost server running Apache 2 and Ubuntu LTC 10.04. 我在运行Apache 2和Ubuntu LTC 10.04的Slicehost服务器上安装了Rails应用程序。 Things have worked beautifully up until now: I edit a file, do a quick mongrel_rails cluster::restart , and the changes are reflected in production. 到目前为止,一切都进行mongrel_rails cluster::restart :我编辑了一个文件,快速执行了mongrel_rails cluster::restart ,更改已反映在生产中。 However, suddenly this process has broken down. 但是,这个过程突然崩溃了。

For example, I have a class called Master located in /lib/master.rb . 例如,我在/lib/master.rb有一个名为Master的类。 I added a new method to this class that simply runs puts "it works!" 我在该类中添加了一个新方法,该方法仅运行puts "it works!" , then restarted the mongrel cluster. ,然后重新启动杂种群集。 Looking at the production logs, the server throws an error and thinks this method doesn't exist. 查看生产日志,服务器抛出错误,并认为该方法不存在。 When I go to the console using ruby script/console production , however, I can use this new method perfectly. 但是,当我使用ruby script/console production进入控制台时,可以完美地使用此新方法。 I even tried deleting the file containing entire Master class. 我什至尝试删除包含整个Master类的文件。 Once again, the production thought it was still there, but the production console correctly recognized it was missing. 生产人员再次认为它仍然存在,但是生产控制台正确地识别出它丢失了。

Any ideas? 有任何想法吗? How can the production environment detect a class that doesn't even exist anymore? 生产环境如何检测甚至不存在的类?

Funny, I spend 2 hours debugging this, then post to StackOverflow and figure it out in 20 minutes. 有趣的是,我花了2个小时来调试它,然后发布到StackOverflow并在20分钟内解决它。

The problem is that I needed to also restart my background jobs as well. 问题是我还需要重新启动后台作业。 They were running the old version of the classes stored in /lib. 他们正在运行旧版本的/ lib中存储的类。 It's interesting that this problem has never snagged me before. 有趣的是,这个问题以前从未困扰过我。

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

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