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.
- Start RadRails
- Go to "help->Install New Software"
- Click "Add"
- Name it DTP and give it this as a location http://download.eclipse.org/datatools/updates
- 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
- Go back into RadRails and switch to the "Database Development Perspective"
- You should see a panel titled "Data Source Explorer"
- Right click in the "Data Source Explore" and go through the wizard using SQLite as your driver.
- Don't forget to click on that target and then select your jar file you just downloaded
- 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.
- Double click on your connection to start it
- With a little exploring you can find your tables
- To view the data create a "sql scrapbook", its one of the buttons at the top of the "Data Source Explorer"
- 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.