0

I have a Rails application on Heroku that is supposed to connect to a MongoLab database. My issue is any command that attempts to access the database in any way results in

undefined method `[]' for nil:NilClass

This includes seeding the db. My mongoid.yml is as follows

production:
  sessions:
    default:
      uri: <%= ENV['MONGOLAB_URI'] %>

development:
  sessions:
    default:
      database: dev_database
      hosts:
        - localhost:27017

This mongoid.yml works fine for another ROR application I have using the same version of Mongoid (3.0.1), so I am unsure why it is giving me issues here. MONGOLAB_URI is defined in the environment. I'm fairly certain the issue must be with the database connection, but I am unsure what. Any ideas how to resolve this issue?

EDIT:

I just tried this to no avail as well...

production:
  sessions:
    default:
      uri: <%= ENV['MONGOLAB_URI'] %>
      options:
        skip_version_check: true
        safe: true

1 Answer 1

1

I forgot Heroku defaults to ruby 1.9.2, adding

ruby '1.9.3'

to my gem file fixed it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.