Mongoid给出未初始化的常量Mongo [英] Mongoid gives uninitialized constant Mongo
本文介绍了Mongoid给出未初始化的常量Mongo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用蒙古包,但它会输出此错误:
I'm trying to use mongoid but it outputs this error:
未初始化的常量"Mongo"
uninitialized constant 'Mongo'
这是我的代码:
require "mongoid"
Mongoid.configure do |config|
config.master = Mongo::Connection.new("localhost",27017).db("arthist")
end
class Artist
include Mongoid::Document
field :name, type: String
end
a = Artist.create(name: "hoge")
你有什么主意吗?
推荐答案
在您的Gemfile中包含gem mongo
并重新启动服务器,它应该可以解决问题.
include gem mongo
in your Gemfile and restart the server it should do the trick.
这篇关于Mongoid给出未初始化的常量Mongo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文