mongrel cluster中的敏感字符:Cluster

来源:互联网 发布:淘宝二维码怎么生成 编辑:程序博客网 时间:2024/05/18 02:31
 
开发在webrick上测试rails应用没有任何问题,但一部署在mongrel cluster上就出问题了
 
总是报
NoMethodError: undefined method `find’ for Cluster:Module
 
也就是在执行Cluster.find出的问题
 
很奇怪的问题,我明明定义一个activerecord class
class Cluster < ActiveRecord::Base
 has_many :servers
 has_many :user_metas
End
 
怎么可能不能执行Cluster.find
 
报错的原因应该是rails把Cluster当成了一个模块而不是一个类,难道有命名冲突
 
后来才发现确实在ruby的lib里,mongrel cluster确实定一个顶级 Cluster module
 
该怎么解决,在网上看到这篇 <http://blog.innerewut.de/tags/mongrel>
和我的问题一样,这位仁兄说:
I already wrote the author about it and hopefully mongrel_cluster will use a separate namespace in the next release
 
希望mogrel官方早日解决这个问题,我也不知道该如何能让rails识别我这个class Cluster,我定义了一个模块Space,通过Space::Cluster访问,还是出现同样的错误,于是我采用了最丑陋的做法,我把我的这个类改了名字