Tuesday, May 11, 2010

Setting up Ubuntu 10.4 for Ruby on Rails Development

In late July last year, I tried the impossible, setting up a Windows machine for Ruby on Rails Development. I spent an entire weekend on the project, and while everything seemed to work at first, once I started writing a simple application, I would receive random errors that I could never make much sense of. Part of the problem may have been with my system, which had Aptana Studio installed previously, but I had removed it after I realized it was just Eclipse with some fancy plug-ins (which could be installed on a standard Eclipse install anyway).

Most of my aggravation lied in getting the database setup. In the end, I was faced with numerous database errors that would crash the Ruby interpreter, and numerous other issues that made me vow to never try to develop a Ruby on Rails application again on Windows.

But, I've recently installed Linux on another machine, and with a few web site ideas bouncing around in my head, I thought it would be best to attempt to learn Ruby on Rails again. In the process of setting this machine up, I ran across this tutorial for installing Ruby on Rails on a Windows machine. While it sounds promising, I have a better alternative (Linux) on hand and won't torment myself with Ruby on Windows again.

(Note: This is not a definitive guide, but just the steps and errors I encountered while setting the machine up.) To setup Ubuntu 10.4 for Rails development, I first fired up Synaptic Package Manager and selected Eclipse, Ruby, Rails, and their corresponding decencies for installation.

Once these have all been installed, I navigated to Radrails.org and went to the Download page and followed the instructions for updating Eclipse. For Eclipse Galileo, navigate to Help > Install New Software. On the dialog that appears, I clicked the link "Available Software Sites", clicked "Add", then provided the URL provided on the Downloads page. Click 'Ok' on this screen and the previous one, returning to the 'Install' screen. In the drop down box at top, select the URL you just provided and once it loads, select the plug-in it lists below.

After the install is done, Eclipse will need to reboot. After it is reloaded, go to Window > Perspectives > Open Perspective.. and select the Rad Rails Perspective. Once this perspective opens, it will display a list of Ruby gems that need to be installed. Select OK to install the Gems.

I received numerous errors at this point, but I'm at a lost on how to fix it. I did copy the errors to examine another day.

Afterwards, I created a new Rails project, but I received an error stating that it could not install the latest version of Rails. But, I installed Rails in the first step, so as the instructions told me, I modified the config/environment.rb file to comment out the RAILS_GEM_VERSION variable, and re-ran the project. The starting project loaded, but as I was running through this tutorial, I ran into a couple of issues.

First, I received the following error:

Routing Error

No route matches "/say/hello" with {:method=>:get}

To fix this error, I modified the Config/routes.rb file to recognize the new controller 'Say'.

Unfortunately I made the fix and started receiving this error:

uninitialized constant ApplicationController

To fix this, I followed the instructions at http://www.hackido.com/2009/03/quick-tip-solve-uninitialized-constant.html, which solved the issue.

Despite a few issues I've ran into so far, my experience of Ruby on Rails on Linux is MUCH better then my experience on Windows.

No comments:

Post a Comment