This PR is similar to this one https://github.com/plataformatec/simple_form/pull/1552.
It allows validation classes on `input_field`.
To get this work I added two configs for the Simple Form:
`input_field_error_class` and `input_field_valid_class`. Once the user
adds a class for these configs, the configured classes will be rendered
according to the form validation.
- Setup the `input_field` classes.
```ruby
SimpleForm.setup do |config|
config.input_field_valid_class = 'is-valid'
config.input_field_error_class = 'is-invalid'
end
```
- Build the form.
```erb
<%= simple_form_for @product do |f| %>
<%= f.input_field :name %>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
```
- When the validation happening, the input will be rendered with the
validation classes.
```HTML
<-- Valid example -->
<input class=" is-valid string required" type="text" value="PS4" name="product[name]" id="product_name">
<-- Invalid example -->
<input class=" is-invalid string required" type="text" value="" name="product[name]" id="product_name">
```
I noticed these files all had strings such as "", " ", "_" that were
allocated each time some common methods were called, over 1000x on a
page in my app. This comment freezes all of these strings such that
they're only allocated once, saving many KB of memory allocation.