siempre faltan cinco para el ser
This commit is contained in:
parent
09b8e50545
commit
036ac78690
1 changed files with 9 additions and 0 deletions
9
config/initializers/bootstrap_field_with_errors.rb
Normal file
9
config/initializers/bootstrap_field_with_errors.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# Adaptar la renderización de campos con error de Rails para que sea
|
||||||
|
# compatible con Bootstrap4. La forma actual rompe los inputs
|
||||||
|
# personalizados.
|
||||||
|
ActionView::Base.field_error_proc = proc do |html_tag, _|
|
||||||
|
html = Nokogiri::HTML::DocumentFragment.parse html_tag
|
||||||
|
html.children.first.attributes['class'].value += ' is-invalid'
|
||||||
|
|
||||||
|
html.to_s.html_safe
|
||||||
|
end
|
Loading…
Reference in a new issue