Question

I am following the Rails Tutorial with the database set up using postgreSQL so the development and production are the same locally and where it is deployed on Heroku. So far so good. I've got the User model set up and working both locally and in deployment to heroku. My problem is that I'd like to access the database in table form locally. It's easy to access SQLite databases using SQLite Database Browser. I've failed to access my app's postgreSQL database.

So far I've downloaded PGAdmin3 which is free but utterly confusing. Next I downloaded Navicat Essentials for PostgreSQL which was $4.99 from the App store. My config/database.yml is:

development:
  adapter: postgresql
  encoding: unicode
  database: [app_name]_development
  pool: 5
  username: [app_name]
  password: 

In Navicat Essentials for PostgreSQL I enter:

Connection Name: Test
Host Name/IP Address: localhost
Port: 5432
Default Database: [app_name]_development
username: [app_name]
password: 

When I hit "Test Connection" it says, "Connection Successful." I still can't seem to figure out how to access the database in table format. I hit the table tab but no data shows up. Anyone with any advice? I've got at least one user already which I can confirm in the rails counsel.

Was it helpful?

Solution

If you're on mac you should take a look at both of the following applications:

Both should be more straightforward than other options.

OTHER TIPS

Note: This is what I did to get Induction working. It may include extra steps and not be the most straitforward but...

1) At my rails root, I cloned the induction app. $ git clone git://github.com/Induction/Induction.git

2) Not sure what I accomplished in step one, I searched in vain for Induction on my hard drive, in the application folder, etc. Returning to the Induction Readme on github, I found a reference to downloads at uri: https://github.com/Induction/Induction/downloads

There I downloaded the latest Induction - Alpha Build (4/12/2012) zip and openned it producing the Induciton App among my downloads. (I will move the app from downloads to my applications directory shortly.)

3) Double clicking on the Induction app opened a dialogue box which I filled with the following info:

Adapter     postgres
Hostname    localhost
Username    [my_rails_app_name]
Password    [I left this blank]
Port        5432
Database    [my_rails_app_name]_development

Note: for the database to open, my postres database had to be "turned on" which I do by opening a new tab in my terminal, navigating to my rails app's directory and typing:

$ postgres -D /usr/local/var/postgres

Back at Induction, with the above database info entered, I hit connect and Induction opened. Within induction I hit "explore" at the top, my model name at the left and there was my data in table form. It is just like SQLite Database Browser for SQLite3 data! Thanks again @CraigKerstines!

Finally, don't forget to move the Induction app from downloads to applications where you can find it in the future.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top