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.

Tagged with: ,

Resources to help you connect to web services

The first time I was required to connect to a web service, I had no idea where to start, and ended up doing things the hard way. I needed to connect to a REST like web service in order to process a credit card transaction. I was coding in php at the time, and created all of my http headers from scratch and sent my request using fsockopen and very low-level function calls. Well, there’s a much easier way to do things. Here are some resources to help you connect to web services.

If you’re programming in Ruby, php, C#, VB.NET, ActionScript, JavaScript, or Python, then the Yahoo! Developer Network has some great resources for you. The gurus at Yahoo! have provided code samples and links to libraries that will help you connect to RESTful and SOAP web services.

If you’ve never connected to a web service before, it is really easy! Yahoo has some cool web services to try out, so have at it!

Web Services Help for:

Tagged with: , , ,

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.

Tagged with: , , ,

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.

Tagged with: , ,