2012-08-13 6 views
5

현재 heroku에 현재 배포 된 a simple app에서 일하고 있습니다. mongoid, device를 사용하고 있으며 localhost에서는 매우 쉽게 사용자 로그인을 만들 수 있습니다. 영웅. 계정을 만들려고 할 수 있으며 제출 후 오류가 발생합니다.MongoidDB, MongoDB, MongoHQ, Rails와 MongoDB 오류가 발생했습니다.

생산을위한 mongoid.yml은 변경해야한다고 생각하지만 어떻게 될지 잘 모릅니다.

source 'https://rubygems.org' 

gem 'rails', '3.2.3' 

group :development, :test do 
    gem 'sqlite3' 
    gem 'rspec-rails' 
end 

group :test do 
    gem 'database_cleaner' 
    gem 'mongoid-rspec' 
    gem 'factory_girl_rails' 
    gem 'email_spec' 
    gem 'capybara' 
    gem 'launchy' 
end 

group :production do 
    gem 'thin' 
end 

group :assets do 
    gem 'sass-rails', '~> 3.2.3' 
    gem 'coffee-rails', '~> 3.2.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 
gem "mongoid", :git => "git://github.com/mongoid/mongoid.git" 
gem "bson_ext" 
gem "devise" 

git push heroku master을 한 후 :

development: 
    sessions: 
    default: 
     database: bookfoo_app_development 
     hosts: 
     - localhost:27017 
     options: 
     consistency: :strong 
    options: 
test: 
    sessions: 
    default: 
     database: bookfoo_app_test 
     hosts: 
     - localhost:27017 
     options: 
     consistency: :strong 
production: 
    sessions: 
    default: 
     uri: <%= ENV['MONGOHQ_URL'] %> 
    options: 
     skip_version_check: true 
     safe: true 

내 gemfile은 다음과 같습니다

=== Config Vars for bookfoo 
DATABASE_URL:  postgres://jeibucpexp:[email protected]/jeibucpexp 
GEM_PATH:   vendor/bundle/ruby/1.9.1 
LANG:    en_US.UTF-8 
MONGOHQ_URL:   mongodb://heroku:[email protected]:10065/app6153931 
MONGOLAB_URI:  mongodb://heroku_app6153931:[email protected]:37097/heroku_app6153931 
PATH:    bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin 
RACK_ENV:   production 
RAILS_ENV:   production 
SHARED_DATABASE_URL: postgres://jeibucpexp:[email protected]/jeibucpexp 

mongoid.yml이에게 Heroku에 제안 다음과 같습니다 내 heroku config

는 다음이있다 그것은 나에게 다음과 같은 힌트를 준다 :

,
There is a configuration error with the current mongoid.yml. 
     Problem: 
     No database provided for session configuration: :options. 
     Summary: 
     Each session configuration must provide a database so Mongoid knows where the default database to persist to. What was provided was: {"skip_version_check"=>true, "safe"=>true}. 
     Resolution: 
     If configuring via a mongoid.yml, ensure that within your :options section a :database value for the session's default database is defined. 
     Example: 
     \_\_development: 
     \_\_\_\_sessions: 
     \_\_\_\_\_\_options: 
     \_\_\_\_\_\_\_\_database: my_app_db 
     \_\_\_\_\_\_\_\_hosts: 
     \_\_\_\_\_\_\_\_\_\_- localhost:27017 

답변

5

mongoid.yml는 (내 들여 쓰기가 잘못) 그렇게해야한다 : 이것에 대한

production: 
    sessions: 
    default: 
     uri: <%= ENV['MONGOHQ_URL'] %> 
     options: 
     skip_version_check: true 
     safe: true 
+0

감사합니다. 나는 이미 몇 시간을 찾고 있었는데 그때 그것이 들여 쓰기임을 깨달았습니다 : / – macool

관련 문제