MongoDB bug with Mongoid, Heroku, Device, MongoHQ and Rails

I am working on a simple application that is currently deployed for heroku - it uses mongoid, a device and can create a user login very easily in the local host, but not in production with the heroku. You can try to create an account and give an error message after sending.

I think my mongoid.yml for production should change, but I have no idea how to do this.

My heroku confighas the following:

 === Config Vars for bookfoo
DATABASE_URL:        postgres://jeibucpexp:bVZzGaGPUeGylwmA7dyE@ec2-107-20-186-97.compute-1.amazonaws.com/jeibucpexp
GEM_PATH:            vendor/bundle/ruby/1.9.1
LANG:                en_US.UTF-8
MONGOHQ_URL:         mongodb://heroku:14bc6d476e6449c952d6350b07e89643@alex.mongohq.com:10065/app6153931
MONGOLAB_URI:        mongodb://heroku_app6153931:og03dk0hdrj7r8lsit51k6ah9n@ds037097-a.mongolab.com: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:bVZzGaGPUeGylwmA7dyE@ec2-107-20-186-97.compute-1.amazonaws.com/jeibucpexp

mongoid.yml has the following suggested in heroku:

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

my gemfile has the following:

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"

after git push heroku masterhe gives me the following tips:

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 default database is defined.
       Example:
       \_\_development:
       \_\_\_\_sessions:
       \_\_\_\_\_\_options:
       \_\_\_\_\_\_\_\_database: my_app_db
       \_\_\_\_\_\_\_\_hosts:
       \_\_\_\_\_\_\_\_\_\_- localhost:27017
+5
source share
1 answer

mongoid.yml should be like this (my indentation was wrong):

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

All Articles