Accessing ActiveRecord#errors inside FormBuilder

Hi there,

I'm trying to implement Simply Accessible's form error messages advice,
explained here:

http://simplyaccessible.org/article/form-error-messages

I'm trying to produce a custom FormBuilder to accomplish this. It's
based on the TaggedBuilder example in the AWDWR2 book.

Of course, I can't use error_messages_on inside my FormBuilder, so I
rolled my own method to acquire the first error message (if any) for an
ActiveRecord instance, and was stunned into submission by the results.

Could someone explain the cause of the XXX comment in my code below, or
suggest another approach?

Thanks,
Sheldon.