Show:

Expected x.rb to define X (LoadError)

April 15, 2009 Programming

I have been working on extending Rails’ I18n Simple backend to make it work with Serbian grammar (post on that will follow soon), but I kept getting an error:

Expected ./lib/serbian_simple.rb to define SerbianSimple (LoadError)

I’ve just spent an hour trying to figure out why this keeps happening and I found that there’s a lot of people with similar problem.

It seems that the problem appears when Rails tries to autoload files. In my case there was a simple solution – I just added require ‘serbian_simple.rb’ in environment.rb to manually load the file.