Search code examples
ruby-on-railsrubypostgresqlpgadmin

Connect Rails app to PGAdmin 4


I am using a CodeAnywhere.com (Firehose) development stack and I am attempting to connect the Postgres SQL database to PGAdmin just so I can have some kind of graphical representation.

The issue is I have no idea how to find the host / server name or databasename.

I saw another question here and saw that I can run this command Rails.configuration.database_configuration[Rails.env] however I am not sure where exactly to run that from the SSH terminal. IRB? Because I get an error running through IRB.

Please let me know if any other information is needed.


Solution

  • Try running this command from the terminal.

    netstat -tunalp 
    

    And look/grep for Postgres. You can pipe the output of the above command into grep.

    This will give you the Host.

    If you want to find it via Rails. Try looking for the file

    config/database.yml