Mongoid 3 + Heroku (MongoHQ) cause Moped::Errors::OperationFailure

后端 未结 3 544
北恋
北恋 2021-01-31 08:32

With Rails 3, after upgrading from Mongoid 2.x to Mongoid 3.x, my Heroku + MongoHQ setup stopped working. Funny thing is, that my development & test frameworks and my whole

3条回答
  •  独厮守ぢ
    2021-01-31 08:56

    As a workaround, hardcoding the uri from heroku config seems to do the trick.

    ex:

    production:
      sessions:
        default:
          uri: "mongodb://heroku:xxxx@domain.mongohq.com:000/appyyyy"
          options:
            skip_version_check: true
            safe: true
    

    I'm guessing the nilclass error was because <%= ENV['MONGOHQ_URL'] %> was returning nil

提交回复
热议问题