Beware of missing Gems in Rails!

Eric PughAugust 9, 2007

Ive 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 gems. I like to think that this kind of error is just due to Rails immaturity. The Rails community hasnt 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”.

Im going to take a stab at putting all our Gems that dont 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 cant go in the /plugins directory I am wrapping in a bit of code to put out a pretty message:

begin
require `cache
rescue RuntimeError
raise "Please install ruby-cache gem"
end

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:


We empower great search teams!

We help teams that use Solr and Elasticsearch become more capable through consulting and training.

Services Training