sgruhier / foundation_rails_helper

Rails Helper for Zurb Fondation framework
MIT License
153 stars 83 forks source link

Overriding the field_error_proc #174

Open akaspick opened 7 years ago

akaspick commented 7 years ago

Globally overwriting the field_error_proc can cause issues if multiple form builders are used in the same app.

A potential solution is to use a similar technique that is used in https://github.com/plataformatec/simple_form, specifically here..

https://github.com/plataformatec/simple_form/blob/48cab46ca4d26236b446d870f5d25cd27e4b4701/lib/simple_form.rb#L175-L178

and here...

https://github.com/plataformatec/simple_form/blob/c3a307cb9501208e053f771738e34a3d93d33858/lib/simple_form/action_view_extensions/form_helper.rb#L41-L49

which only changes the field_error_proc within the custom form builder.

dsandstrom commented 7 years ago

What would be a use case for using multiple form builders?

akaspick commented 7 years ago

@dsandstrom One form builder for an admin backend and another for a public frontend as one example.