[英]Uninitialized constant ActiveRecord::Singleton
I need to define a singleton ActiveRecord model. 我需要定义一个单例ActiveRecord模型。 I do this: 我这样做:
class Universe < ActiveRecord::Base
include ActiveRecord::Singleton
end
But I receive an error: uninitialized constant ActiveRecord::Singleton. 但是我收到一个错误:未初始化的常量ActiveRecord :: Singleton。 I assume, I missed require "something" . 我想,我错过了要求“东西”的地方 。 What should I require? 我需要什么?
Are you sure you are actually looking for ActiveRecord::Singleton? 您确定您确实在寻找ActiveRecord :: Singleton吗? There is a Singleton-Module in the rails-standard-library: 在rails-standard-library中有一个Singleton-Module:
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/singleton/rdoc/Singleton.html http://www.ruby-doc.org/stdlib-1.9.3/libdoc/singleton/rdoc/Singleton.html
maybe this is what you are looking for?! 也许这就是您要寻找的?
I searched through the Rails documentation for 3.03 and I don't see any reference to ActiveRecord::Singleton. 我在Rails文档中搜索了3.03 ,但没有看到对ActiveRecord :: Singleton的引用。 Are you absolutely sure this is a valid name? 您绝对确定这是有效名称吗?
I did find a reference to this library that appears to add this functionality though. 我确实找到了对该库的引用,但似乎添加了此功能。 Are you using this library? 您在使用这个库吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.