We write our Rails programs using a programmer’s editor. We’ve found over
the years that different editors work best with different languages and envi-
ronments. For example, Dave originally wrote this chapter using Emacs
because he thinks that its Filladapt mode is unsurpassed when it comes to
neatly formatting XML as he types. Sam updated the chapter using Vim. But
many think that neither Emacs nor Vim is ideal for Rails development.
Although the choice of editor is a personal one, here are some suggestions of
features to look for in a Rails editor:
report erratum ? discuss
Setting Up Your Development Environment ? 9
? Support for syntax highlighting of Ruby and HTML. Ideally support for
.erb files (a Rails file format that embeds Ruby snippets within HTML).
? Support of automatic indentation and reindentation of Ruby source. This
is more than an aesthetic feature: having an editor indent your program
as you type is the best way of spotting bad nesting in your code. Being
able to reindent is important when you refactor your code and move stuff.
(TextMate’s ability to reindent when it pastes code from the clipboard is
? Support for insertion of common Ruby and Rails constructs. You’ll be
writing lots of short methods, and if the IDE creates method skeletons
with a keystroke or two, you can concentrate on the interesting stuff
? Good file navigation. As you’ll see, Rails applications are spread across
many files; for example, a newly created Rails application enters the world
containing forty-six files spread across thirty-four directories. That’s before
you’ve written a thing.
You need an environment that helps you navigate quickly between these.
You’ll add a line to a controller to load a value, switch to the view to add
a line to display it, and then switch to the test to verify you did it all right.
Something like Notepad, where you traverse a File Open dialog box to
select each file to edit, just won’t cut it. We prefer a combination of a tree
view of files in a sidebar, a small set of keystrokes that help us find a file
(or files) in a directory tree by name, and some built-in smarts that know
how to navigate (say) between a controller action and the corresponding
? Name completion. Names in Rails tend to be long. A nice editor will let
you type the first few characters and then suggest possible completions
to you at the touch of a key.
We hesitate to recommend specific editors because we’ve used only a few in
earnest and we’ll undoubtedly leave someone’s favorite editor off the list.
Nevertheless, to help you get started with something other than Notepad,
here are some suggestions:
? TextMate was once the Mac OS X de facto standard text editor for Ruby
Chapter 1. Installing Rails ? 10
report erratum ? discuss
? Sublime Text10 is a cross-platform alternative that some see as the de
facto successor for TextMate.
? Aptana Studio 311 is an integrated Rails development environment that
runs in Eclipse. It runs on Windows, Mac OS X, and Linux. Originally
known as RadRails, it won an award for being the best open source
developer tool based on Eclipse in 2006, and Aptana became the home
for the project in 2007.
? jEdit12 is a fully featured editor with support for Ruby. It has extensive
? Komodo13is ActiveState’s IDE for dynamic languages, including Ruby.
? RubyMine14 is a commercial IDE for Ruby and is available for free to
qualified educational and open source projects. It runs on Windows, Mac
OS X, and Linux.
? NetBeans Ruby and Rails plugin15 is an open source plugin for the popular
Ask experienced developers who use your kind of operating system which
editor they use. Spend a week or so trying alternatives before settling in.