Seattle Software Developers


Pugetworks Blog Archive!

Querying Ruby on Rails data through RadRails

With just a little work you can add the ability to see into the sqlite database that Ruby on Rails uses as a default for your project.

Step 1. Install the plug-in

Since RadRails is based on Eclipse you can use any plug-in written for Eclipse. For this task we will use the Data Tools Platform or DTP plug-in.

  1. Start RadRails
  2. Go to "help->Install New Software"
  3. Click "Add"
  4. Name it DTP and give it this as a location http://download.eclipse.org/datatools/updates
  5. RadRails will walk you through the rest of the setup, when you are done you should have some new functionality

Step 2. Download the latest driver

  • Go to here and download the sqlite driver jar onto your machine

Step 3. Add your datasource as a new connection

  1. Go back into RadRails and switch to the "Database Development Perspective"
  2. You should see a panel titled "Data Source Explorer"
  3. Right click in the "Data Source Explore" and go through the wizard using SQLite as your driver.
  4. Don't forget to click on that target and then select your jar file you just downloaded
  5. When it ask you the database file select the file in your rails project called db/development.sqlite

Step 4. Connect

Now for the fun part.

  1. Double click on your connection to start it
  2. With a little exploring you can find your tables
  3. To view the data create a "sql scrapbook", its one of the buttons at the top of the "Data Source Explorer"
  4. Put some sql in there and run it. You should see the data returned into the "Sql Result" panel

Congradulations, you should be setup now to use RadRails with DTP. It has some neat features like caching the sql results so you can compare them at later times.


Rails, RubyMatt Paulin