2

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.

2 Answers 2

4

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

Both should be more straightforward than other options.

3
  • Very, very cool, @CraigKerstines. I've got Postgres working on my maching for the moment so am staying away from Postgres app. But Induction app is exactly what I need and it works beautifully. Since getting it working wasn't completely strait forward and I expect that other "I'm following the Rails Tutorial" newbies may need some guidance, I've expanded on what I did to get it working in my own answer below. I'm 1200 characters too long for a comment
    – BenU
    May 16, 2012 at 20:59
  • @CraigKerstines is there an alternative of Induction for Linux (namely Ubuntu)?
    – dialex
    Feb 1, 2014 at 16:46
  • @DiAlex I can't say theres a much better native client than PgAdmin for Linux. Though I am actually working on a post now to review several Postgres GUI admin tools. It will be more Mac focused, but should hit on a few others as well which may be helpful to you. It should be up in coming days/weeks at craigkerstiens.com in case you want to check it out. Feb 4, 2014 at 16:25
3

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.

1
  • If you're using Postgres App along with Induction, setting the username to your system username (i.e. the one you use to log into your computer) worked for me.
    – sq1020
    Feb 11, 2013 at 17:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.