the blog
Back to -Blog

Visual Rails Workbench - Differencing and Round-Tripping

Into the archives...
by Dermot Hogan
Monday 10 March 2008.

The main aim to the Visual Rails Workbench is to allow a designer (or an artistically inclined programmer) to build a ‘composite’ representation of a Rails view and, optionally, to export it to DreamWeaver (say) for ‘pixel perfect’ alignment and composition. But what happens if something has gone wrong? How do you track down the error?

I’ve been doing quite a bit of testing and bug-fixing over the last two weeks on the Visual Rails Workbench (RWB). The RWB’s main job is to assemble a composite page from a view, layout and various partial pages. You can then tweak the design of the resulting composite to use different images and styles. Using both the code editor and the RWB’s drag-and-drop design environment, you can substantially alter the page layout by moving, adding, deleting and resizing HTML elements or controls such as buttons and text entry fields.

The entire composite page can then be exported to DreamWeaver (say), do some ’fine detail’ design in a tool rather more suited for the purpose than Visual Studio’s HTML editor. When you’ve finished in Dreamweaver, you simply re-import the result back into Visual Studio.

The next step is to disassemble to composite back into its constituent parts, ready for Rails to do its stuff via a web browser and server. But how do you track down any problems caused by editing the composite either externally or internally?

The RWB always takes a backup of any file that it overwrites when the composite is disassembled. This means that, after making a number of changes, you will end up with all your ’previous edits’ in the backup folder. You can restore any of these older versions by using the Revert tool:

Just select the backup file in the left hand panel, the text will appear in the right panel, and you can replace the current text by clicking the Revert button.

Now as I was testing the RWB, the first set of tests was always a ‘round-trip’. That is, build a composite and immediately disassemble it with no changes. Of course, there should be no change in the underlying view/layout/partials (this is actually quite a stringent test). But what I wanted was a tool that would tell me this. The first thing I thought of was a simple file compare. But then I realised that a much more useful thing would be a ‘diff/merge’ tool, that allowed me to browse (and possibly merge) the differences.

So I added one:

Here, I’m using the Microsoft TeamServer diffmerge.exe, but you can choose whatever diff/merge tool you like (such as the free WinMerge tool).

I have to say that having added the diff/merge tool, I don’t know how I managed before. It saves a huge amount of time.

See also...
- A Brief Guide To The Visual Rails Workbench
- A Brief Guide To The Visual Rails Workbench - part 2
- Visual Rails Workbench - The Import/Export Business
- Visual Ruby and Rails - Our Philosophy
- Visual Rails Workbench - screencast preview

The Visual Rails Workbench will form a part of the next version (1.2) of Ruby In Steel Developer. This will be a free upgrade to registered users. The 2nd beta of Ruby In Steel 1.2 was released to registered users on the 9th of March, 2008. The final release is expected to ship within the next few weeks.

Bookmark and Share   Keywords:  ide
© SapphireSteel Software 2014