mongoid with rails - Database should be a Mongo::DB, not NilClass"

Posted by Adam T on Stack Overflow See other posts from Stack Overflow or by Adam T
Published on 2010-05-30T22:23:57Z Indexed on 2010/05/30 22:32 UTC
Read the original article Hit count: 295

Filed under:
|
|

Greetings

I am trying to get Mongoid to work with my Rails app and I am getting an error: "Mongoid::Errors::InvalidDatabase in 'Shipment bol should be unique' Database should be a Mongo::DB, not NilClass" I have created the mongoid.yml file in my config directory and have mongodb running as a daemon. The config file is like so:

defaults: &defaults
host: localhost

development:
<<: *defaults
database: ship-it-development

test:
<<: *defaults
database: ship-it-test

production: <<: *defaults
host: <%= ENV['MONGOID_HOST'] %>
port: <%= ENV['MONGOID_PORT'] %>
database: <%= ENV['MONGOID_DATABASE'] %>

All of my specs fail with the above error. I am using rails 2.3.8.

Anyone have ideas?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about mongodb