In Rails Connect to Remote Database on localhost, task can be achieved by editing database.yml file in your Rails application. Make changes to host, username, password and database in your database yaml file to connect to remote database.
What is database.yml?
You might want to see the Article on what is database.yml file contains and what is meaning of each and every parameter present in the database.yml file
Where is database.yml?
Development Database Configuration:
Your development environment for Rails Application might be containing database.yml file containing this type of connection parameters
What to Edit ?
After you edit this settings in database.yml, when you run your development environment by rails console command, then your Rails Application will connect to the remote database from the connection parameters that you have provided in database.yml file.
If you face any issue while trying to connecting to remote database on your localhost, then let us know through comments.
For more information on Rails configurations, you can refer Configuring Rails Apps
Subscribe to Ruby in Rails
Get the latest posts delivered right to your inbox