[Request] Error options for to_sentence #682

toriaezu opened this Issue Sep 14, 2011 · 3 comments


None yet

2 participants


errors_helper.rb line 46

Inline errors are concatenated with the to_sentence option of rails. If we have for example two errors
on the same field it could get a bit messy. Let's say a field has a "Can't be blank." and a "Must be a color."
error messages.
If the field is left empty and submitted we will see the following: "Can't be blank. and Must be a color."

Is it possible to include options to the to_sentence method? Using :word_connector, :two_words_connector and
:last_word_connector hash it could be possible to customize the concatenation of the two error messages.


Would you want to customise this on a per-input basis, or app-wide?


Well, having both would be great. I was thinking of giving formtastic an app-wide attribute hash in the
locales.yml. With the option to override it per-input basis, also in the locales.


Rails already provides configuration for this through the i18n API, so we don't have to provide this in Formtastic. Rails looks in the support.array.words_connector, support.array.two_words_connector and support.array.last_word_connector keys. Closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment