我目前在我的 mongoid.yml 中使用以下设置(不起作用),并且我已将MONGOLAB_URI
环境变量正确添加到我的 heroku 环境中:
production:
sessions:
default:
another:
uri: <%= ENV['MONGOLAB_URI'] %>
我还尝试了以下不起作用的方法:
production:
uri: <%= ENV['MONGOLAB_URI'] %>
这也不起作用:
production:
sessions:
default:
uri: <%= ENV['MONGOLAB_URI'] %>
我在 heroku 推送中收到以下错误:
Running: rake assets:precompile
There is a configuration error with the current mongoid.yml.
Problem:
No database provided for session configuration: :default.
Summary:
Each session configuration must provide a database so Mongoid knows where the default database to persist to. What was provided was: {"another"=>{"uri"=>nil}}.
Resolution:
If configuring via a mongoid.yml, ensure that within your :default section a :database value for the session's default database is defined.
Example:
\_\_development:
\_\_\_\_sessions:
\_\_\_\_\_\_default:
\_\_\_\_\_\_\_\_database: my_app_db
\_\_\_\_\_\_\_\_hosts:
\_\_\_\_\_\_\_\_\_\_- localhost:27017
There is a configuration error with the current mongoid.yml.
Problem:
No database provided for session configuration: :default.
Summary:
Each session configuration must provide a database so Mongoid knows where the default database to persist to. What was provided was: {"another"=>{"uri"=>nil}}.
Resolution:
If configuring via a mongoid.yml, ensure that within your :default section a :database value for the session's default database is defined.
Example:
\_\_development:
\_\_\_\_sessions:
\_\_\_\_\_\_default:
\_\_\_\_\_\_\_\_database: my_app_db
\_\_\_\_\_\_\_\_hosts:
\_\_\_\_\_\_\_\_\_\_- localhost:27017
Asset precompilation completed (15.47s)
我在这里做错了什么?我已按照 mongoid.org 的说明进行操作:
http://mongoid.org/en/mongoid/docs/installation.html
我正在使用mongoid 3.0.0.rc