Mike Perham

On Ruby, software and the Internet

ActiveSupport Dependency arcanery

January 16th, 2008 · No Comments

I was getting the following error when running some Ruby code and a Google search  did not clarify what the problem was.  ‘to_constant_name’: Anonymous modules have no name to be referenced by (ArgumentError)

Essentially the problem was dependency load order.  The error was due to this line:

      ActiveRecord::Base.send(:include, AttributeMapper)

The problem was that I had not required ActiveRecord yet so ActiveSupport blew up with this arcane error.  So, if you start to see odd errors like above, stop and think about any require/load changes you might have recently made.  A quick ’svn diff’ showed me exactly what I had changed 5 minutes before to cause this problem.

Tags: Rails

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment