如何正确配置mongoid用于开发和登台环境?

Den*_*hin 2 ruby ruby-on-rails heroku mongoid

我在本地机器上创建了两个开发环境,并在heroku上创建了一个.

在这里我的'mongoid.yml':

development:
  sessions:
    default:
      database: mydb_development
      hosts:
        - localhost:27017
staging:
  sessions:
    default:
      database: mydb_staging
      uri: <%= ENV['MONGOLAB_URI'] %>
Run Code Online (Sandbox Code Playgroud)

Mongoid在本地机器上正常工作,但在heroku部署之后我接下来的错误:

/app/vendor/bundle/ruby/1.9.1/gems/mongoid-3.0.14/lib/mongoid/config/validators/session.rb:81:in `validate_session_uri':  (Mongoid::Errors::MixedSessionConfiguration)
2012-12-25T10:12:44+00:00 app[web.1]: Problem:
2012-12-25T10:12:44+00:00 app[web.1]:   Both uri and standard configuration options defined for session: 'default'.
2012-12-25T10:12:44+00:00 app[web.1]: Summary:
2012-12-25T10:12:44+00:00 app[web.1]:   Instead of simply giving uri or standard options a preference order, Mongoid assumes that you have made a mistake in your configuration and requires that you provide one or the other, but not both. The options that were provided were: {"database"=>"xxxxx_staging", "uri"=>"mongodb://xxxxx:xxxxx@xxxxx.mongolab.com:37587/xxxxxx"}.
2012-12-25T10:12:44+00:00 app[web.1]: Resolution:
2012-12-25T10:12:44+00:00 app[web.1]:   Provide either only a uri as configuration or only standard options.
Run Code Online (Sandbox Code Playgroud)

什么短语'只提供uri作为配置或仅提供标准选项'是什么意思?如何正确配置mongoid进行开发和升级?

Dog*_*ert 5

删除此行:

database: mydb_staging
Run Code Online (Sandbox Code Playgroud)

因为数据库名称存在于URI中.