Accessing error messages in a custom FormBuilder

Hi there,

I'm trying to create a FormBuilder called LabellingBuilder, to
implement Simply Accessible's form error messages strategy:

The problem is that
ActionView::Helpers::ActiveRecordHelper#error_messages_on isn't
available in subclasses of ActionView::Helpers::FormBuilder.

So I tried to write my own little error fetcher and was stunned by the
results -- while @object_name is correctly set, @object is nil, as
indicated by the XXX comment in the code below.

Can anyone help me with this code?