The following code presents a pillbox style selection element in a form that returns a valid list of values, but the search is case sensitive:
<%= hidden_field_tag "notification[:equips_ids][]", nil %>
<input name="notification[equip_ids][]" type="hidden" value="" />
<select multiple="multiple" class="custom-select select2" name="notification[equip_ids][]" id="notification_equip_ids">
<% [email protected]? %>
<% @notification.equips.each do |equip| %>
<option selected="selected" value="<%= equip.equip_id %>"><%= equip.equip_info %></option>
<% end %>
</select>
I have studied the Select2 documentation, Ruby on Rails helper classes, my own code, this forum, examined my UI elements with Developer Tools, and searched Google with as many different search terms as I could think up. Any idea how I can make the selection case insensitive? Thank you for your time - I hope I finally figured out how to ask a decent question. I sure don't want to lose the privilege!
This issue was fixed in select2 version 4.0.6
but the problem that select2-rails is using select2 4.0.3
which is an older version and it doesn't contain the fixes for your problem:
Reference:
https://github.com/select2/select2/commit/cb9a90457867ffb14c7b1550bb67e872e0a5c2dd
https://github.com/argerim/select2-rails
You have 2 options:
1) Create an issue on select2-rails & ask them to migrate select2 to the latest version or you may contribute as well.
OR
2) To fix this issue manually, get latest JS files from select2 & overwrite your local files (but be careful when you are running bundle as the fixes may be overwritten by bundler in case a new version has been issued by select2-rails). Also, you can add the fixes in the tag.js file as below:
https://github.com/select2/select2/commit/cb9a90457867ffb14c7b1550bb67e872e0a5c2dd