HOW-TO: Configure eclipse for Ruby on Rails

May 2nd, 2006

UPDATE 17-NOV-2007: Rad Rails has been bought out by Aptana. The installation process has changed and this article is likely out of date. Aptana’s installation guide can be found here.

Before you proceed with this how-to, you will need to install ruby and ruby on rails on your machine (and also install and configure mysql). There are many guides avaiable on this. You can access them from the main wiki or, if you are on Suse Linux, you can use the guide that I used (written by Axel Wolf). If you are setting this up on a non-windows environment, you may need to run some of the steps as root. It will be pretty easy to tell if this is the case as the script will complain about permissions. If you run into any problems just post a comment, I may be able to help out.

IMPORTANT: You must be running Eclipse 3.1 or higher.

In this guide, I will go over how to configure eclipse for Ruby on Rails. In the next one, I will go over setting up a simple project.

For setup eclipse for Ruby on Rails, you first have to add and configure the Ruby Development Tools (RDT) plugin to eclipse (steps 1-14). Once you are done with that, you then need to add and configure the Rad Rails plugin (steps 15-23).

STEP 1: Fire up eclipse, select the following menu: Help–>Updates–>Find and Install…

STEP 2: Select “search for new features to install” and select next.

STEP 3: Click on the “New Remote Site…” button

STEP 4: Enter “RDT” as the name and “http://updatesite.rubypeople.org/release” as the URL. Press the OK button.

STEP 5: Click on RDT and press the Finish button. Wait for it to contact the update site. This is usually only a few second wait. In rare cases, it may take up to a minute.

STEP 6: Click on RDT and click on the Next button.

STEP 7: Accept the license and click next.

STEP 8: Click Finish

STEP 9: We can trust ’em :) Go ahead and click install. It will now download all the components it needs for the RDT. This took about a minute for me.

STEP 10: It is good to follow recomendations some times. Click Yes to restart the workbench.

STEP 11: After eclipse relaunches, select Windows–>Preferences. Expand the Ruby section and click on “Installed Interpreters”.

STEP 12: Click on the Add button.

STEP 13: I suggest putting in the Ruby version as the interpreter name. To find out what version of Ruby you are running, open a terminal window and type “ruby -v”. Enter the location of the ruby runtime. For my configuration, ruby was installed in /usr/local/bin. Click on the OK button when these fields are filled.

STEP 14: Click OK. You have now successfully added the RDT to eclipse.

STEP 15: Ok, now it is time to add Rad Rails to eclipse. Select Help–>Software Updates–>Find and Install…

When the dialog comes up, select “Search for new features to install” as you did before and click next. Then click on the “New Remote site…” button.

STEP 16: Enter “Rad Rails” as the name and “http://radrails.sourceforge.net/update” as the URL. Click on the OK button.

STEP 17: Click on Rad Rails, and hit the Next button.

STEP 18: We can trust these guys too. Hit the Install button. When the install is done, a dialog will come up as before recommending a restart. Click the Yes button to restart eclipse.

STEP 19: After eclipse relaunches, select Windows–>Preferences.  This time expand “Rails” and click on “Rails Install”. Add in the directory where you have installed rails.

STEP 20: Now check to see if the new project wizard works for Rails. Select File–>New Project… from the menu.

STEP 21: Expand the Rails folder and select “Rails Project”. Click on the Next button.

STEP 22: Enter the obligatory “HelloWorld” as the project name and click on the Finish button.

STEP 23: Everything looks good. Except we are currently looking at a perspective designed for Java! We are doing Ruby on Rails programming here, better to have a perspective designed for that work. So, time to open a Rails perspective. Select “Window->Open Perspective->Other…”. Select Rails

Hit OK and you will find yourself in an eclipse perspective specifically designed for Rails. Now that you have your environment set-up, you are ready for your first application tutorial :)

Entry Filed under: How-to,Ruby

Trackbacks

14 Comments Add your own

  • 1. Green Ruby Programmer&hellip  |  May 24th, 2006 at 12:10 am

    links from Technorati HOW-TO: Configure eclipse for Ruby on Rails

  • 2. Ruby on Rails News&hellip  |  May 3rd, 2006 at 12:28 am

    Kramer auto Pingback[…] […]

  • 3. Sonjaya Tandon » HO&hellip  |  May 7th, 2006 at 10:44 pm

    […] This tutorial assumes you are using mySql as your database and have already downloaded and setup a development environment for rails. If you haven’t, you can check out my HOW-TO on setting up eclipse for Ruby on Rails development. […]

  • 4. HowToUseEclipseForRailsDe&hellip  |  May 24th, 2006 at 3:56 pm

    Kramer auto Pingback[…] For a more detailed tutorial on adding the RadRails plugin to Eclipse:http://sonjayatandon.com/05-2006/how-to-configure-eclipse-for-ruby-on-rails/ […]

  • 5. RoR Wiki Wiki - HowT&hellip  |  August 4th, 2006 at 4:19 am

    Kramer auto Pingback[…] Eclipse RadRails ץ饰ɲääȾܺ٤ʥ塼ȥꥢ: http://sonjayatandon.com/05-2006/how-to-configure-eclipse-for-ruby-on-rails/ […]

  • 6. HowToUseEclipseForRailsDe&hellip  |  October 12th, 2006 at 2:09 am

    Kramer auto Pingback[…] For a more detailed tutorial on adding the RadRails plugin to Eclipse:http://sonjayatandon.com/05-2006/how-to-configure-eclipse-for-ruby-on-rails/ […]

  • 7. hal_robertson  |  May 24th, 2007 at 3:40 pm

    I have set up everything as indicated with ease.

    However, when I go to create a new project, as described, I go to New Rails Project, and type in the project name, “Hello World” and hit, “Finish” and, for a *split* second I see a status message and a progress bar appear in the create new project window — it says, “Creating Project.” Then, the “Creating Project” status message and progress bar disappears and I’m still left looking at the create new project window, with no error message, or indication of success or failure.

    The “HelloWorld” folder is created in my workspace folder, but, however, it’s empty. I assume Eclipse failed to execute the rails command. How do I debug this?

    Any ideas?

    Thanks for a great tutorial. It was exactly what I was looking for. Simple, easy, and straightforward. Except, it didn’t work for me … :(

  • 8. sonjaya  |  May 24th, 2007 at 10:50 pm

    I while back I had something like that happen to me. In the end it was because I was properly pointing to my rails environment.

    It sounds like, for some reason, it is unable to run rails w/in eclipse on your system. So that could be because config for ruby is not quite there, or config for rails.

    Check all the settings in Windows->preferences. You may be using a different version of rad rails then the one I based this article on. Make sure all the directories look right.

  • 9. hal_robertson  |  May 31st, 2007 at 9:58 am

    Thanks, Sonjaya, for the response. I double checked my preferences and everything seems fine. I posted my message with more details of my configuration to http://groups.google.com/group/radrails in hopes of finding more help.

  • 10. vintermann  |  November 5th, 2007 at 2:00 am

    Is it normal that a newly created Rails project is chock full of syntax errors?

    For instance, the first one is in in_memory_connection.rb, and the line looks like this:
    load(“#{File.dirname(__FILE__)}/../../fixtures/db_definitions/schema.rb”))

    Looks like a parenthesis too much, but how on earth did that happen in a newly created file? I try to fix it, but it was created write-protected – although I can certainly make it writable, it seems like a strong hint I’m not supposed to edit that file (or have to)…

    Error in an Eclipse plugin? My rails version?

  • 11. qkerby  |  November 16th, 2007 at 9:27 am

    For those with the same problem as Hal Robertson, Rad Rails was acquired by Aptana. Don’t use the old Rad Rails.

    http://www.aptana.com/docs/index.php/Installing_RadRails

  • 12. sonjaya  |  November 17th, 2007 at 11:11 pm

    Thanks for that link qkerby. For those stopping by, this blog entry is getting a bit dated, so probably best to check out that link.

  • 13. Discover From Your Favori&hellip  |  December 3rd, 2007 at 8:19 am

    Kramer auto Pingback[…] […]

  • 14. [RadRails] RadRails Confi&hellip  |  December 15th, 2007 at 3:22 pm

    Kramer auto Pingback[…] I just installed a fresh copy of Eclipse 3.2.2, and installed org.radrails.rails-feature 0.7.2 and Ruby Development Tools 0.9.0.200704141430RC1 following Sonjaya’s excellent tutorial: http://sonjayatandon.com/05-2006/how-to-configure-eclipse-for-ruby-on-rails/ I got through all the steps with ease, however, when I go to create a new raisl project, I go to New Rails Project, and type in the project name, "HelloWorld" and hit, "Finish" and, for a *split* second I see a status message and a progress bar appear in the create new project window – it says, "Creating Project." Then, the "Creating Project" status message and progress bar disappears and I’m still left looking at the create new project window, with no error message, or indication of success or failure. The "HelloWorld" folder is created in my workspace folder, but, however, it’s empty. I assume Eclipse failed to execute the rails command. How do I debug this? Sonjaya said I should double check my Eclipse preferences, however they seem accurate: In Eclipse, Window .. Preferences, I have: Rails > Configuration: Rails Path: /opt/local/bin/rails Rake Path: /opt/local/bin/rake Mongrel Path: /opt/local/bin/mongrel_rails Ruby > Installed Interpreters Name: opt_local_bin_ruby Location: /opt/local/bin Type: Standard VM I am running a Mac w/ macports installation of ruby and rails >From my terminal: halr:~ hal$ which rails ruby mongrel_rails /opt/local/bin/rails /opt/local/bin/ruby /opt/local/bin/mongrel_rails halr:~ hal$ ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1] halr:~ hal$ rails -v Rails 1.2.3 halr:~ hal$ mongrel_rails –version Mongrel Web Server 1.0.1 Does anybody have any advice on how I can debug the problem? Did I miss something in my configuration? –~–~———~–~—-~————~——-~–~—-~ You received this message because you are subscribed to the Google Groups "RadRails" group. To post to this group, send email to radrails@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/radrails?hl=en -~———-~—-~—-~—-~——~—-~——~–~— […]

Leave a Comment

You must be logged in to post a comment.

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

May 2006
M T W T F S S
« Apr   Jun »
1234567
891011121314
15161718192021
22232425262728
293031  

Most Recent Posts