I'm currently using the following settings (which does not work) in my mongoid.yml and i've correctly added the MONGOLAB_URI
environmental variable to my heroku environment:
production:
sessions:
default:
another:
uri: <%= ENV['MONGOLAB_URI'] %>
I also tried the following which does not work:
production:
uri: <%= ENV['MONGOLAB_URI'] %>
This also does not work:
production:
sessions:
default:
uri: <%= ENV['MONGOLAB_URI'] %>
I'm getting the following error on the heroku push:
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)
What am I doing wrong here? I've followed the mongoid.org instructions:
http://mongoid.org/en/mongoid/docs/installation.html
I am using mongoid 3.0.0.rc
Try this
ENV['MONGOLAB_URI'] = ds053681.mongolab.com:97321
production:
sessions:
default:
hosts:
- <%= ENV['MONGOLAB_URI'] %>
database: testapp_production
username: testappuser
password: testpassword
abhas's example didn't work for me. This is what finally worked:
production:
sessions:
default:
uri: <%= ENV['MONGOHQ_URI'] %>
options:
skip_version_check: true
safe: true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With