]> git.openstreetmap.org Git - rails.git/blobdiff - config/initializers/field_error.rb
Return an error when basic authentication is used and is disabled
[rails.git] / config / initializers / field_error.rb
index 41f2c2d52d37fd11a17d768423e693d9294dfd53..34b224296cce6506a9f4240fc33083867a2fc404 100644 (file)
@@ -1,9 +1,9 @@
-ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
+ActionView::Base.field_error_proc = proc do |html_tag, _instance|
   class_attr_index = html_tag.index 'class="'
 
   if class_attr_index
-    html_tag.insert class_attr_index+7, 'field_with_errors '
+    html_tag.insert class_attr_index + 7, "field_with_errors "
   else
-    html_tag.insert html_tag.index(/\/?>/), ' class="field_with_errors"'
+    html_tag.insert html_tag.index(%r{/?>}), ' class="field_with_errors"'.html_safe
   end
 end