Reputation: 96484
I'm using
<%= fields_for @reservation do |r| %>
....
<span data-to="date">
<%= r.select :end_day, options_for_select((0..7).map{|offset| Time.zone.today + offset}) %>
</span>
...
<% end >
to identify the element through the span but I would rather identify the select control itself and apply the data-to to it (not the individual options, though that will be next).
I tried
<%= r.select :end_day, options_for_select((0..7).map{|offset| Time.zone.today + offset}), data:{to: 'date'} %>
but the attribute didn't show.
Upvotes: 1
Views: 851
Reputation: 115521
<%= r.select :end_day, options_for_select((0..7).map{|offset| Time.zone.today + offset}), {}, data: {to: 'date'} %>
Because signature is:
select(method, choices, options = {}, html_options = {})
Upvotes: 1