Working with Rails Data

btn_watchdemo20070807

The core of Track Magic is it’s ability to use Panorama to create a local, synchronized RAM based copy of your Rails database for viewing and editing the data without using a web browser. To illustrate this I'll build a local copy of the catalogs table in the hobbyshop application. I simply click the + button to create the local copy of the database (I could also choose Create Local Synchronized Database from the Table menu).

001_CreatingSyncedDatabase

Track Magic sets up the local database structure, then asks how I want to synchronize the new database with the Rails server.

002_DoYouWantToDownload

I’ll choose Download All, which in this case downloads 96 records from the Rails table into the local database. By default, the local database is displayed using a spreadsheet like row and column view called the data sheet (later you’ll see how to set up alternate custom views).

003_NewDataSheet

Track Magic tries to guess how wide each column in the data sheet should be, but as you can see above, it doesn’t do a perfect job. However, it’s very easy to change the width of any column. Just move the mouse over the column name (the mouse indicator will become a double arrow) and then drag left or right. (Note: This is different from some programs that require you to drag in the space between the columns — Panorama allows you to drag with the mouse anywhere in the column name area.)

005a_ChangeColumnWidth

Now that the local database is set up I’ll choose the Save command from the File menu to permanently save this configuration (field structure, column widths, etc.). This saves the local catalogs database in the vendor folder of the hobbyshop rails application. This allows me to re-use this local database later without having to start from scratch.

At any point I’ve also got the option of saving the data in the local database as a YML fixture for later reloading into the Rails table.

004_ExportYMLFixture

Once the data is saved as a fixture you can reload it later from Track Magic, and of course it can be automatically loaded by your Ruby test code. See Fixtures for more information.

Basic Data Editing

To edit a particular data cell I simply double click on the cell. (I can also single click and then press the Tab key).

006_EditDataCell

This pop-ups a small editing window over the data cell, allowing me to edit the data.

007_EditDataCell

When I’m done I press the Return, Enter or Tab key, or click outside the pop-up window. The edit data changes color, to show that it has not yet been uploaded to the Rails server.

008_EditDataCell

For tall and/or wide data I can expand the pop-up window to any size. I simply move the mouse over the bottom right hand corner of the window. When in the corner the mouse arrow will flip upside down, at which point I can drag the corner to expand the pop-up window.

009_ExpandDataCell

I can now enter and edit text in the expanded pop-up window. When the pop-up window is expanded pressing the Return key starts a new line, so I have to press Enter or Tab to finish (or click outside the window).

010_ExpandDataCell

Here’s what the data sheet looks like after I’ve made changes to five different data cells.

011_MultiplePendingChanges

So far all of these changes have been made to the local RAM based copy of the database only. The Rails table hasn’t been touched, so my next step is to choose the Update All Changes to Rails command from the Rails menu.

012_RailsMenuUploadChanges

The five cells I modified are uploaded to the Rails table. No other cells in the Rails table are touched (even cells in the same records as the changed cells). The local data sheet changes to show only the records that contain cells that were updated.

013_UploadedData

When I'm ready to continue I choose Select All from the Search menu. This makes all 96 records visible again.

Continue the Tour —> Data Changes en Masse