This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Install webrick | |
# gem install webrick | |
# Then run this script | |
require 'webrick' | |
require 'fileutils' | |
require 'optparse' | |
options = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save this file to your_rails_project/config/initializers/ | |
# With this code, a form-input-error class can be applied to the input so that it can be styled by tailwindcss or CSS. | |
# See the original definition on | |
# https://github.com/rails/rails/blob/c5bf2b4736f2ddafbc477af5b9478dd7143e5466/actionview/lib/action_view/base.rb#L145 | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
if html_tag.start_with? '<input' | |
html_tag.gsub(/class="[^"]+"/, 'class="form-input-error"').html_safe | |
else | |
html_tag | |
end |