레일 마운트 가능한 앱을 만들고 'mongoid'및 'rspec'보석을 추가했습니다. spec_helper.rb
모든 정상적인 작동에 나는 Mongoid.load!(Rails.root.join("config", "mongoid.yml"))
라인을 추가하면Rails Engine + Mongoid : 'default'라는 세션에 대한 구성을 찾지 못했습니다.
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.
: 내 사양을 실행하려고하면 지금 나는 다음과 같은 오류가 발생합니다.
왜로드 기능을 호출 할 필요가없는 일반 Rails 앱에서와 같은 기능을 사용할 수 있습니까?
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
버전 :
gem 'rails', '~> 3.2.12'
gem 'mongoid', '~> 3.1'
gem 'rspec-rails', '~> 2.13'
당신은 당신의 mongoid.yml 파일을 게시 할 수 있습니까? –