0

ruby version is 1.9.2p290

I am using the following gemset

D:\work\software\mongoid>gem list

* LOCAL GEMS *

abstract (1.0.0)
actionmailer (3.1.3, 3.1.0, 3.0.1)
actionpack (3.1.3, 3.1.0, 3.0.1)
activemodel (3.1.3, 3.1.0, 3.0.1)
activerecord (3.1.3, 3.1.0, 3.0.1)
activerecord-alt-mongo-adapter (0.1.0)
activerecord-sqlserver-adapter (3.1.0.0)
activeresource (3.1.3, 3.1.0, 3.0.1)
activesupport (3.1.3, 3.1.0, 3.0.1)
ansi (1.4.1)
arel (2.2.1, 1.0.1)
bcrypt-ruby (3.0.1 x86-mingw32, 3.0.0 x86-mingw32)
bson (1.5.2, 1.1.1)
bson_ext (1.5.2, 1.1.1)
builder (3.0.0, 2.1.2)
bundler (1.0.18)
coffee-rails (3.1.1, 3.1.0)
coffee-script (2.2.0)
coffee-script-source (1.2.0, 1.1.3, 1.1.2)
erubis (2.7.0, 2.6.6)
execjs (1.2.13, 1.2.12, 1.2.4)
hike (1.2.1)
i18n (0.6.0, 0.4.2)
jquery-rails (1.0.19)
json (1.6.3)
mail (2.3.0, 2.2.19, 2.2.9)
mime-types (1.17.2, 1.16)
minitest (2.9.1, 1.6.0)
mongo (1.5.2, 1.0.9)
mongo_mapper (0.10.1)
mongodb (2.1.0)
mongoid (2.3.4, 2.0.0.beta.19)
multi_json (1.0.4, 1.0.3)
open4 (1.1.0)
pg (0.11.0 x86-mingw32)
Platform (0.4.0)
plucky (0.4.3)
polyglot (0.3.3, 0.3.2, 0.3.1)
POpen4 (0.1.4)
rack (1.3.5, 1.3.2, 1.2.4, 1.2.1)
rack-cache (1.1, 1.0.3)
rack-mount (0.8.3, 0.6.14, 0.6.13)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7, 0.5.6)
rails (3.1.3, 3.1.0, 3.0.1)
railties (3.1.3, 3.1.0, 3.0.1)
rake (0.9.2.2, 0.9.2, 0.8.7)
rb-readline (0.4.1)
rdoc (3.12, 3.9.4)
rubygems-update (1.8.12)
rubyzip2 (2.0.1)
sass (3.1.12, 3.1.11)
sass-rails (3.1.5)
sprockets (2.0.3)
sqlite3 (1.3.5 x86-mingw32, 1.3.4 x86-mingw32)
sqlite3-ruby (1.3.3, 1.2.5 x86-mingw32)
thor (0.14.6, 0.14.3)
tilt (1.3.3)
tiny_tds (0.4.5 x86-mingw32)
treetop (1.4.10, 1.4.8)
turn (0.8.3, 0.8.2)
tzinfo (0.3.31, 0.3.29, 0.3.23)
uglifier (1.2.0)
will_paginate (3.0.2, 3.0.pre2)

when I run rake db:migrate, I am getting the error

Please install the mongo adapter: gem install activerecord-mongo-adapter (no s uch file to load -- active_record/connection_adapters/mongo_adapter)

when trying to install activerecord-mongo-adapter, I am getting the error

ERROR:  Could not find a valid gem 'activerecord-mongo-adapter' (>= 0) in any re
pository

database.yml contains the following code...,

development:
      adapter:  mongo
      host:     localhost
      port:     27017
      database: mongo_development

test:
  adapter: mongo
  database: mongo_test
  host: localhost

production:
  adapter: mongo
  database: mongo_production
  host: localhost

1 Answer 1

0

Mongoid isn't an ActiveRecord adapter

If you want to use mongoid then you don't need to use ActiveRecord at all (unless of course you also have a SQL database your app uses). If you don't need active record then you'll probably need to disable the active record framework entirely or else it will probably complain about not being able to connect.

So in addition to not putting mongo stuff in database.yml, your models look like

class Person
  include Mongoid::Document
  ...
  end
end

rather than inheriting from ActiveRecord::Base

It also means no Activerecord migrations etc.

Sign up to request clarification or add additional context in comments.

1 Comment

The person who originally asked the question attempted to edit your post and ask for more information. Their edit has been rejected since they should have left a comment, but you can read what they attempted to ask here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.