Select2 Find existing or type new always show first option as blank

I added a select2 and it always show first option as blank.
just below the blank option, it always shows what i type in select2 textfield. Any Idea, how i can fix it.

enter image description here
= hidden_field_tag :tags // present in HAML form

// javascript 
$('#tags').select2
createSearchChoice: (term, data) ->
  if $(data).filter((->
      @text.localeCompare(term) == 0
    )).length == 0
    return {
      id: term
      text: term
    }
  return
multiple: false
data: [
  {
    id: 0
    text: 'story'
  }
  {
    id: 1
    text: 'bug'
  }
  {
    id: 2
    text: 'task'
  }`enter code here`
]


Source: ruby

Leave a Reply