plataformatec/simple_form — pull request #566 by jim (2012-05-09 16:01:09+00:00)
Title: Preserve ActionView::Base.field_error_proc

I'm migrating an app to use simple_form, and I've run into a few situations where nested calls to some of the simple_form methods results in `ActionView::Base.field_error_proc` getting trampled. This manifested itself in an app by preventing its custom error proc from getting called on any non-simple_form page after a page with the nested simple_form calls was loaded.

I solved this issue by using a local variable to hold the value of the existing proc instead of a class variable.

It is possible to avoid this without making changes to simple_form (for example, by using `form.fields_for` instead of `simple_fields_for` inside of a `simple_form_for` block), but it doesn't seem like it should be possible to corrupt an application's configuration by calling any of the supported API methods.

I also attempted to make sure the original error proc was restored even when an exception was raised inside `with_simple_form_field_error_proc`.