I have an application running on Heroku, and I want to configure a connection to a second database (from another application running on Heroku). All the solutions that I saw for several databases are related to the database.yml file, but Heroku does not do it this way, they instructed me to use DATABASE_URL from one application to another.
I think I need to do something like:
DatabaseName::Base.establish_connection(DATABASE_URL)
and then i can use
establish_connection :DatabaseName
in the respective models. Where i put
DatabaseName::Base.establish_connection(DATABASE_URL)
so that it is available for all models? environment.rb? And why is this the correct syntax?
source share