RadRails Error – No such file to load — rubygems (LoadError)

I’m using the Eclipse plug-in named RadRails to work on Rails projects. I’m running on Mac OS X, and I finally got past this error that would come up every time I tried to generate a Model, Controller, or anything for that matter:

No such file to load -- rubygems (LoadError)

Strange thing is, generating models, controllers, and such worked just fine from my bash shell, but not from within Eclipse. I thought it was something to do with my system PATH variable, but that was not the case.

The way to fix this error is to add ruby to your list of interpreters in:

Window => Preferences => Ruby => Installed Interpreters

Add an interpreter, name it Ruby, and give it the path to your ruby binary file. To find where that is located, just type which ruby from your shell prompt.

I hope this helps someone else. It took me a long time to find a solution for this.

Picking up Ruby on Rails after CakePHP

So, I’m finally diving into Ruby on Rails. The transition to Ruby on Rails from using CakePHP is going fairly smoothly. Now that I am really comfortable with the MVC framework that CakePHP uses, the learning curve has been pretty minimal.

My web hosting provider offers Ruby on Rails support, but I don’t like editing files directly on a server, so I decided to get things running locally on my own machine. It has been kind of a headache to get things working with FastCgi. Without FastCgi, everything runs pretty slow. With fcgi support, it runs really fast, which is nice. Just remember that you must restart Apache after you change your database.yml file.

If you want to start developing on Rails, I suggest following the WARR (Windows Apache Ruby on Rails) setup instructions. These instructions finally got my fcgi to work. You don’t have to put things in the directories that the tutorial suggests, especially if you are already set up with apache, mysql, etc.

If you want to learn some of the basics on Ruby, I suggest the following sites:

  • Try Ruby – This site lets you type ruby commands into a little console in the browser window. No installation needed, just a browser. Follow their tutorial! It gives a pretty good, quick run-through of Ruby programming principles.
  • Why’s (Poignant) Guide to Ruby – This is an online book that is an easy read.

If you’re looking for some good Rails tutorials check out:

If you really want a good understanding of Ruby on Rails, and Ruby, I suggest buying these books:

  • Agile Web Development with Rails – This is a good book whether you’re learning Rails or another inspired framework such as CakePHP. It was written by David Heinemeier Hansson, who is one of the master minds behind Rails and is on the 37Signals team. All parts of the MVC framework are discussed thoroughly in this book, and it has the best explanations for Model relationships such as Belongs To, Has One, Has and Belongs To Many. This book is awesome.
  • Programming Ruby – This is an in depth guide to Ruby programming. It covers the basics all the way to the advanced features such as distributing Ruby objects across several processes and servers, much like Java’s RMI or CORBA. It is written by Dave Thomas (not the Wendy’s guy) who is also a co-author of the Agile Web Development with Rails book.

So, now I’m off and running, or at least jogging, with Ruby on Rails. Ruby is a really cool programming language. A lot of stuff seems backwards from what I’m used to with languages such as Java or php, but the differences actually make Ruby super elegant. It will take me a while to become super proficient in it, but I’m on my way.

I’ve already noticed some differences between Ruby on Rails and CakePHP, which I’m taking note of. I’ll write again soon with a detailed comparison of CakePHP and Ruby on Rails.

Why I use CakePHP over Ruby on Rails

[Update for all visitors: I’ve written a new post name Why I Prefer Ruby on Rails over CakePHP. Please visit that for a more up to date opinion.]

In response to Blake’s question on my last post “Why I Like CakePHP”, the main reason is that I still use CakePHP over Ruby on Rails is availability of php programmers. It’s a lot easier to find someone who does php than it is to find someone who does Ruby.

Also, if we are building projects that will eventually be deployed on a client’s server, the client will eventually need to maintain it. It is easier for them to support a php solution over a Ruby on Rails solution because because they will find more people familiar with php than ruby.

For a comparison of language popularity, although I realize this doesn’t say it all, here is a Google Trends chart comparing php with ruby.

PHP, Ruby comparison

PHP is in blue, and Ruby is in red.

Now I admit that Ruby on Rails is a superior product over CakePHP. Rails was built for a language like Ruby, not for php. However, php does a good enough job with handling the Rails-like MVC framework. All that said, I wish Ruby was more popular because it would be fun to jump into.

It seems that a lot of the php community, including myself, have become very framework-centric. I think this stems from frustrating hours/days/weeks of digging through spaghetti code, trying to debug php applications.

Because of the immense popularity of php, I think one of the php MVC frameworks will catch fire and surpass Rails in popularity.

CakePHP – a good transition into Ruby-on-Rails

About two months ago, I was introduced to CakePhp, a Ruby-on-Rails-inspired php framework. After studying the various rails-inspired php frameworks, I decided that Cake was the way to go. My experience has been great, although there have been some bumps along the road.
For almost a year, I had been wanting to dive into Ruby-on-Rails. I had successfully completed a few Rails tutorials, but, at the time I didn’t program in Ruby. Therefore the lines were blurred as to what was being done by Ruby and what was being done by Rails magic. CakePHP has provided a great transition for me, as I’ve been able to learn the framework without learning Ruby.

I have read most of Agile Web Development with Rails, and am now able to differentiate between the Rails work and the Ruby work. Ruby looks like a really fun language to learn, and I hear it is really powerful. I would love to jump into it fully now and reap the benefits of this beautiful framework.

I wouldn’t ever want to develop another site without a good php framework. CakePHP is a great framework to work with. However, it still isn’t as mature as Ruby-on-Rails, and doesn’t support all of the features that Rails does. That’s why I still want to jump into Ruby-on-Rails.