fish
fish

Reputation: 39

How do I access remote mLab development db in Rails 5 app?

I'm currently setting up a new Rails 5 app with an existing remote db in mongolab. I'm using mongoid. Here's how I've setup development under config/mongoid.yml:

database: <insert_database_name>
hosts: 
 - <db_number>.mlab.com

options:
 user: <db_user_username>
 password: <db_user_password>

I even tried replacing the above params with the uri string inside development but no luck. I want to be able to access the remote db using rails console. What am I missing?

Upvotes: 1

Views: 404

Answers (2)

duy le
duy le

Reputation: 73

I use the same syntax that you use to config for database and it still work for me rails 5 and mongoid 5. Here what i set. Hope it help!!

  database: manga_app
  hosts:
    - ds151108.mlab.com:51108
  options:

    # The name of the user for authentication.
    user: 'xxx' (xxx is the username you set for database not the name you use to sign in)

    # The password of the user for authentication.
    password: 'yyy' (yyy is the password you set for the database not the password you use to sign in) 

Upvotes: 1

fish
fish

Reputation: 39

Resolved. Had to degrade the Rails installation to 4.2.7 and mongoid 4. Worked like a charm.

Upvotes: 0

Related Questions