Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding the field_error_proc #174

Open
akaspick opened this issue Feb 8, 2017 · 2 comments
Open

Overriding the field_error_proc #174

akaspick opened this issue Feb 8, 2017 · 2 comments

Comments

@akaspick
Copy link

akaspick commented Feb 8, 2017

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
Copy link
Collaborator

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

@akaspick
Copy link
Author

akaspick commented Feb 8, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants