While I refuse to call this “magic”, the following has been confusing me for a long time now and I’ve finally decided to post it to my blog and see if anyone else gets it.
It turns out that ActiveScaffold and YARD don’t play nice together. In particular, if YARD has previously been loaded (say, to define a Rake task for it), ActiveScaffold initialization will fail with the following error:
uninitialized constant Helpers::ControllerHelpers
--trace and following the source code, I find out that this is happening during ActiveScaffold’s initialization, particularly at this statement:
Debugging the ActiveScaffold initialization code yields this baffling result:
>> ActiveScaffold::Helpers => Helpers >> ActiveScaffold::Helpers::ControllerHelpers NameError: uninitialized constant ActiveScaffold::Helpers
It’s the weirdest thing that I’ve seen since I became a Rubyist and it is blocking me from using YARD to generate the documentation for my current Rails project. Unfortunately, cutting out ActiveScaffold isn’t going to fly because the deadline for initial release is so close and so much functionality is implemented using it already. It wasn’t my choice; if I had my way, I might never use ActiveScaffold ever again.