Hi everybody,
I needed change field error rendering for some forms created with Rail’s form builder. I found solution by changing ActionView::Base::field_error_ proc to own before form and changing it back after form rendered.
I don’t like this solution
It’s not thread-safe (but it’s not so important, nobody really wants it :), but I don’t like it because of I think it isn’t good object desing.
Yuck - I’ve been there before (although I stored the override in Thread.current so that it was thread safe).
How complicated would be adding some extra option to formbuilder, like :form_field_error_proc, that can be propagated down to the ActiveRecord’s InstanceTag implementation? Or have you some other idea how to make this better?
Last time the interaction between that and all the various helpers was a little gnarly. Personally I’ve taken not to using field_error_proc and just adding classes on the inputs (or on its enclosing element) to indicate invalidness. field_error_proc could definitely use some love though
Fred