3

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 ) %>

Which 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 at hand is: my attribute is data-date-clearBtn, but Rails renders data-date-clearbtn (lowercase b). How can I avoid this problem? I also tried:

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

1 Answers1

1

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

I don't think you can overwrite that behavior directly, you should either write your helper or type the html tag manually. The rails helper is designed in that way

Community
  • 1
  • 1
Francesco Belladonna
  • 11,361
  • 12
  • 77
  • 147