Mongo :: Connection的未定义方法`schema_cache'

时间:2012-06-30 14:13:20

标签: ruby-on-rails mongodb devise

尝试将添加 Mongodb添加到现有应用中。而且我收到了这个错误。不知道如何解决它,更不用说了解它。

这是因为我试图加载主页,而Devise也正在打电话:

  1: .grid_24
  2:   .center-stuff
  3:     - if user_signed_in?
  4:       = link_to 'Begin Lesson', esson_path, class: 'button-green'
  5:     - else
  6:       %p Welcome :)

错误

ActionView::Template::Error (undefined method `schema_cache' for #<Mongo::Connection:0x007f89a7247dd0>):

我的user.rb文件

class User < ActiveRecord::Base
  include MongoMapper::Document         

我的初始化程序

require 'mongo_mapper'
MongoMapper.connection = Mongo::Connection.new
MongoMapper.database = "ai_project-#{Rails.env}"

1 个答案:

答案 0 :(得分:1)

用户模型不应扩展ActiveRecord。删除它,你应该好好去