Beware of missing Gems in Rails!

Eric PughAugust 9, 2007

I’ve been getting the incredibly cryptic message undefined method options for []:Array (NoMethodError) from Mongrel on startup when moving from one laptop to another.

I googled around, and finally realized that it was due to missing gem’s. I like to think that this kind of error is just due to Rail’s immaturity. The Rails community hasn’t decided how to manage reusable code. You can either use plugins, gems, or one of the various hybrid tools that make gems into plugins! It does highlight that until we have tools to verify that our dependencies are available, versus blindly throwing a cryptic misleading exception, that the best approach is to “Vender Everything”.

I’m going to take a stab at putting all our Gems that don’t have native code into our /plugins directory, hopefully reducing the amount of hunting around the source to identify what dependencies there are that new folks have to go through. And those that can’t go in the /plugins directory I am wrapping in a bit of code to put out a pretty message:

require ‘cache’
rescue RuntimeError
raise “Please install ruby-cache gem”

Reducing the time it takes for a new developer to get up and running on a project means less frustration, less hand holding, and a better experience for everyone!

More blog articles:

Let's do a project together!

We provide tailored search, discovery and personalization solutions using Solr and Elasticsearch. Learn more about our service offerings