Setting up a Rails Development Environment on Windows Using Eclipse
This article is completely out of date. Fortunately, there are much better ways to work with Rails on Windows now, and so this Eclipse-based solution is no longer supported.
Rails on Windows
Last updated on December 2, 2007 6:41 PM
I’ve updated all of the broken links and tested this against the new Eclipse 3.2 and Web Tools 1.5. This is the most stable, most responsive version ever!
This latest updated goes hand in hand with the release of Eclipse for Rails, a pre-packaged version for developers looking to try Eclipse. If you’re already using Eclipse for development in other areas such as Flex or Java, then you should follow the steps in this tutorial.
I also added a Downloads section where I’ll be placing some templates and helper files to speed up the process.
Please, as always, provide some feedback. I can’t answer emails about issues not directly related to the setup of this plugin.
This is a quick yet detailed guide on how to set up a very easy-to-use development environment for Ruby On Rails. This guide is for Windows users but there’s no reason that it couldn’t be adapted for Linux users as well. The guide assumes that you already have a working database installed or available and that you have Ruby installed to c:\ruby.
Lastly, this is not a guide on how to get started with Ruby on Rails! This is simply one method to create a useful IDE for Rails development.
Table of Contents
- Download and install Ruby and Rails
- Install Eclipse
- Configure Eclipse for Rails
- Install the Ruby Developer Tools package
- Configure the RDT plugin
- Launching External Rails Scripts within Eclipse (Now with downloadable goodness!)
- Configure Eclipse to Create Rails Projects
- Configure Eclipse to Launch the Web server
- Configure Eclipse to Create Rails Models
- Configure Eclipse to Create Rails Controllers
- Configure Eclipse to Generate Scaffold for Controllers and Views
- Setting up the Favorites
- Working with Rails Projects in Eclipse
- Create a new Rails Project
- Show All Files
- Install the DBEdit Eclipse plugin
- Connect to a Database
- Configure Eclipse to handle you View files
- Add code hints for the views
- Debugging within Eclipse
- Setting up Breakpointer
- Using Breakpointer
- Installing SubClipse
- Troubleshooting (Updated!)
- Downloads (New!)
- Screenshots
Download and install Ruby and Rails
I am operating under the assumption that you’re going to use the One-Click Ruby Installer created by Curt Hibbs. If you don’t, then you’re going to have to modify these instructions yourself.
- Download and install the One-Click Ruby Installer for Windows
- http://rubyforge.org/projects/rubyinstaller/
- Grab 1.8.6-25 (Direct download)
- These instructions assume you have installed this to c:\ruby (the default location)
- Open a command prompt and type
- gem install rails –include-dependencies
- gem install mongrel –include-dependencies
- With Mongrel, choose the first Win32 option in the list.
- gem install mysql –include-dependencies
Install Eclipse
Eclipse is going to need the Sun Java JRE in order to run. A lot of developers already have this. However, if you are one of the few that doesn’t have this installed already, you need to grab it from here. Install it with all of the defaults and then continue with this guide.
- Create a folder called rails at the root of your C:| drive. We’ll be putting lots of things in there.
- Download Eclipse 3.3.0 with the Web Tools Plugin 2.5 already installed from this page.
- Unzip the files to C:\rails\eclipse
- The archive already contains an /eclipse/ folder
- You can ignore any errors you might receive when you unzip the files. I recommend using something other than the built-in Windows unzipping utility because it can be very slow. Look at WinRar.
- Make a shortcut to C:\rails\eclipse\eclipse.exe
- Start Eclipse and set the workspace to ..\workspace
- This folder should get created for you. The Workspace is where your Rails projects will be kept, and it’s also where all of your settings will reside.
- When Eclipse starts up for the first time, dismiss the Welcome screen by closing its tab. This displays the Java perspective. You’re ready to start customizing your workspace for Ruby on Rails development.
[Content continues with detailed Eclipse configuration instructions…]
Troubleshooting
I used Cygwin and all the paths in your tutorial are wrong. You should change them or make a note about this.
- You’re on your own. This guide uses a specific method. It can easily be adapted for other uses, such as Cygwin or even Linux. However, please understand that I can’t support all of those configurations. Compared to developing useful web applications, configuring these plugins should be pretty easy.
When I try to run one of the external programs, I get an error stating something about “not valid in prolog”
- You probably set up all of your external apps as Ant Builds instead of programs.
When I run one of the external programs, the message says “variable references empty selection”
- It usually means that the project isn’t selected. Just click on the project name before you run one of the programs.
That about does it. I’ll keep looking for other things to add to this procedure since this is the method I am now using for my development environment. If anyone has any feedback that I should add, please send it to ror_dev (at) napcs.com
Thanks to Tom Davies for his comments regarding project locations and his tips about the Rails templates.
Thanks to Chris Williams for the information about WEBrick’s output.
Thanks to everyone on the RDT team for working so hard on a great plugin.