Sharing MongoHQ database between Sinatra and Rails applications in Heroku

209 views Asked by At

I have a Sinatra and Rails 3 applications. Applications were created independently and are hosted in 2 separate Heroku instances. So I need a share one MongoHQ database to both applications. How can I do it? Any idea?

Thanks.

1

There are 1 answers

1
John Beynon On BEST ANSWER

It's really easy.

In the application that has the MongoHQ database look at the output of heroku config - you're looking for the entry MONGOHQ_URL.

All you need do is on the other application set a similar config variable to the same value as displayed from the the first application and then use it as ENV['MONGOHQ_URL'] in your second application.