diff --git a/lib/bootstrap_form/helpers/bootstrap.rb b/lib/bootstrap_form/helpers/bootstrap.rb index 7f3d7d3f..d5c62749 100644 --- a/lib/bootstrap_form/helpers/bootstrap.rb +++ b/lib/bootstrap_form/helpers/bootstrap.rb @@ -75,9 +75,10 @@ def prepend_and_append_input(name, options, &) input = capture(&) || ActiveSupport::SafeBuffer.new input = attach_input(options, :prepend) + input + attach_input(options, :append) - input << generate_error(name, id) + error = generate_error(name, id) + input << error options.present? && - input = tag.div(input, class: ["input-group", options[:input_group_class]].compact) + input = tag.div(input, class: ["input-group", ("has-validation" if error), options[:input_group_class]].compact) input end diff --git a/test/bootstrap_form_group_test.rb b/test/bootstrap_form_group_test.rb index acc9d102..e844279d 100644 --- a/test/bootstrap_form_group_test.rb +++ b/test/bootstrap_form_group_test.rb @@ -195,7 +195,7 @@ class BootstrapFormGroupTest < ActionView::TestCase