Ich habe eine Rails Mountable App erstellt und 'Mongoid' und 'Rspec' Gems hinzugefügt. Wenn ich versuche, meine Brille jetzt betreibe ich die folgende Fehlermeldung erhalten:Rails Engine + Mongoid: Es konnte keine Konfiguration für eine Sitzung mit dem Namen 'default' gefunden werden.
Mongoid::Errors::NoSessionConfig:
Problem:
No configuration could be found for a session named 'default'.
Summary:
When attempting to create the new session, Mongoid could not find a session configuration for the name: 'default'. This is necessary in order to know the host, port, and options needed to connect.
Resolution:
Double check your mongoid.yml to make sure under the sessions key that a configuration exists for 'default'. If you have set the configuration programatically, ensure that 'default' exists in the configuration hash.
Wenn ich die Mongoid.load!(Rails.root.join("config", "mongoid.yml"))
Linie in den spec_helper.rb
alles funktioniert normal.
Warum ist das und wie bekomme ich die Funktionalität wie in einer normalen Rails App, wo ich die Ladefunktion nicht aufrufen muss?
mongoid.yml
development:
sessions:
default:
database: dummy_development
hosts:
- localhost:27017
options:
options:
test:
sessions:
default:
database: dummy_test
hosts:
- localhost:27017
options:
consistency: :strong
max_retries: 1
retry_interval: 0
Versionen:
gem 'rails', '~> 3.2.12'
gem 'mongoid', '~> 3.1'
gem 'rspec-rails', '~> 2.13'
Können Sie Ihre mongoid.yml Datei schreiben? –