Rails: lowercase text_field attributes

I have the following text_field

:

<%= f.text_field( :with_created_at_gte, class: 'form-control datepicker filterrific-periodically-observed', 'data-provide': 'datepicker', "data-date-clearBtn": true ) %>

      

What are the outputs:

<input class="form-control datepicker filterrific-periodically-observed" data-provide="datepicker" data-date-clearbtn="true" type="text" value="05/08/2015" name="filterrific[with_created_at_gte]" id="filterrific_with_created_at_gte">

      

The problem is this: my attribute data-date-clearBtn

, but Rails displays data-date-clearBtn

(lowercase b). How can I avoid this problem? I've also tried:

<%= f.text_field( :with_created_at_gte, class: 'form-control datepicker filterrific-periodically-observed', data: { 'provide': 'datepicker', "date-clearBtn": true } ) %>

      

+3


source to share


1 answer


Note that html tags and attributes are case insensitive, check the comments in that, so Rails is actually correct in this situation.



I don't think you can rewrite this behavior directly, you have to either write your own helper or manually enter the html tag. The rail assistant is designed this way

+1


source







All Articles