This describes the RadRails/Eclipse development environment. See Rails for the framework, Eclipse for the editor.

Installation

There are two ways to install RadRails:

Monolithic

If you only want to run RadRails, you can simply download it, untar it, and then run the RadRails executable in the top-level directory. Too easy.

Advantages

  • Couldn't be easier to set up.
  • You'll be using the same software stack as tons of other people. Most integration bugs should be shaken out pretty quickly.

Drawbacks

  • You get an old version of Subclipse that doesn't work well with Subversion 1.4. Hopefully this will change in RadRails 0.7.2. Nope! Maybe RadRails 0.8.0.
  • You can't install other plugins (such as Quantum and GotoFile).
  • You get annoying but minor errors when switching between RadRails and full Eclipse (like "Workspace View could not be parsed: will be reset" and then you lose your workspace's current state).

Integrated

You can also install RadRails using Eclipse's built-in plugin updater.

First, of course, you must already have Eclipse installed. On Debian/Ubuntu: $ sudo apt-get install eclipse On other platforms: go to http://eclipse.org/ and follow the download instructions.

Now, install RadRails. Choose Help -> Software Updates -> Find and Install, select Search for New Features, click next, and then New Remote Site. Add:

Then accept the license agreements and you should have a full RadRails environment. You may need to open up the Subclipse tree and unselect the "Subclipse Mylar Integration" package -- you won't need it for RadRails.

Advantages

  • Integrates nicely into your existing Eclipse setup
  • You can use whatever plugins you want (such as GotoFile or a modern version of Subclipse).

Drawbacks

  • You need to manually install all the plugins you're going to use.
  • You'll be using a plugin combination that very few other people probably have used. You may see some weird behavior when plugins interact badly.

Related Tools

GotoFile

  • Install GotoFile (link below) todo: write more here.

Database Tools

The database editor included with RadRails sucks, and it doesn't appear to be receiving any developer attention. And thank goodness because there are a number of database editors out that are much better than RadRails could ever hope for.

SQL Explorer

This offers a fast, easy to use SQL command line. Follow the instructions in http://www.radrails.org/tag/radrailstutorials to install it.

Quantum

Quantum offers a graphical editing environment. It's easier and faster to poke through data here but it's not very flexible.

First, go into the Callisto repository and install Calliso -> Graphical Editors and Frameworks -> Graphical Editing Framework. Then download the latest Quantum release from http://quantum.sf.net and . Or, if they've finally set up an update site then by all means use that!

Now, read Help -> Help Contents -> QuantumDB User's Guide -> Getting Started. For some reason, database connections are called "bookmarks."

You'll probably want to use the MySql JDBC driver since MySql -- for better or for worse -- appears to be the de facto Rails database. "sudo apt-get install libmysql-java" and then right-click Database Bookmarks -> New Bookmark -> Add Driver -> Add External Jar. Specify /usr/share/java/mysql.jar and com.mysql.jdbc.Driver. From here on things should be mostly self-explanatory. Double-click the new bookmark to open it.

Starting

On Ubuntu, Eclipse uses gcj by default. In my experience, gcj tends to run slower than native Java and has a few obscure bugs. To use native java by default, first set your preferences to use native java by default (this will fix those Azureus bugs you're seeing too):

$ sudo apt-get install sun-java5-jre
   $ sudo update-alternatives --config java
          # select the one that looks like /usr/lib/jvm/java-1.5.0-sun/jre/bin/java

And now tell Eclipse to use the default java since, strangely, it appears to ignore the current settings.

$ eclipse -vm /usr/bin/java

Keybindings / Editing

RadRails

Control-Shift-V: switches between controller and view. Control-Alt-T: switch to test Control-Alt-X: extract partial

We now have templates in RHTML files.

RDT

Check out the outline view.

Eclipse

  • Incremental Find: Control-J to start, type the term, hit down-arrow for next, up-arrow for prev, and return or escape to accept the find. Hit delete to undo your last keypress. When you're used to Vim/Emacs/Firefox, this feels VERY clunky. The vi editor includes a decent incremental search.
  • Install gotofile. Find a file by hitting control-alt-N and typing some parts of the filename.
  • Control-Shift-R: Open resource. This dialog doesn't do very well finding identially named files in different projects though; use gotofile instead.
  • Control-/: comment lines
  • Control-\: uncomment lines
  • Control-Space: content assist -- try to complete the current phrase
  • Control-Shift-Space: content help -- try to explain where the cursor is (probably not RDT)
  • Control-1: Quick Fix -- try to fix associated object. (probably not RDT)
  • Control-I: indent lines (just like tab right?) It should correct indentation but it does not.
  • Alt-Shift-J: add quote block
  • Control-Shift-F: format block. Unfortunately, this appears to format the entire document. Is there any way to restrict it to just formatting the current selection or line?

What about folding? How do I fold-all and unfold-all?

Double-click a bracket to find the matching bracket

TODO: Talk about RDT's debugging

Actually, somewhere I ran across someone telling how to make some debug module, ruby-debug?, work really well with Eclipse. Need to find that again.

Complaints

What the hell is this about a "workspace"? Why can't I just tell it to treat some arbitrary folder anywhere on my filesystem is a Java project? Keeping everything locked down in some Eclipse-mandated area is just disgusting.

It can. Just specify where to save the project when creating it. Dunno how well this works though.

Why doesn't it support triple-click for selecting an entire line? I use triple-click everywhere. This might be the second most frustrating thing about the IDE.

Why on earth can't it wrap? If some TextMate or VI user inputs a 400-character comment, you have to get really friendly with the horizontal scroll bar.

What I would do if I had time to work on radrails

  • First, jettison the cruft. Get rid of the JavaScript editor and integrate either Aptana's or I think I read about an Eclipse Tools version. Get rid of the database editor.
  • Then, make the generate dialog useful. It should prompt me for everything! Why should I have to remember what should be singular, capitalized, what options I can pass, etc? It should be just click and chug.
  • Improve error reporting. EVERYTHING should go in the console. There are just too many silent errors.
  • Only then would I spend time adding autocompletion and other editor niceties.