anchor.diff:          predicate_select.change()
   
         return true
  +
  +    predicate_changed: (e) ->
  +      target   = $(e.currentTarget)
  +      p = target.val() || ""
  +      base_id = target.attr('id').slice(0, -1)
  +      query_input = $('input#' + base_id + "v_0_value")
  +
  +      # We need to use a dummy input to handle multiple terms
  +      multi_id = query_input.attr('id') + '_multi'
  +      multi_input = @element.find('#' + multi_id)
  +
  +      if Select2?
  +        # Turn query input into Select2 tag list when query accepts multiple values
  +        if p in ["in", "not_in"] || p.match(/_(all|any)$/)
  +          # Add dummy 'multi' input for select2 if not already added
  +          if multi_input.length == 0
  +            @setup_multi_query_input(target, query_input, multi_id)
  +          return
  +        else
  +          if multi_input.length > 0
  +            # Otherwise, remove Select2 from multi-query input, and remove input
  +            multi_input.select2('destroy').remove()
  +            query_input.val('').show()
  +
  +      # Hide query input when not needed
  +      if p in ["true", "false", "blank", "present", "null", "not_null"]
  +        query_input.val("true")
  +        query_input.hide()
  +        query_input.parent().find('.ui-datepicker-trigger').hide()
  +      # Otherwise, reset query input and show datepicker trigger if present
  +      else
  +        unless query_input.is(":visible")
  +          query_input.val("")
  +          query_input.show()
  +          query_input.parent().find('.ui-datepicker-trigger').show()
  +
   
       # Attempts to find a predicate translation for the specific column type,
       # or returns the default label.
  
positive.code: 
          $.each available, (i, p) =>
            [val, label] = [p[0], p[1]]
            if val in predicates
              # Get alternative predicate label depending on column type
              label = this.alt_predicate_label_or_default(val, column_type, label)
              predicate_select.append $('<option value='+val+'>'+label+'</option>')
  
          # Select first predicate if current selection is invalid
  
negative.code:     options: {}
  
      _create: ->
        el = @element
        el.on 'click', '.add_fields',                $.proxy(@add_fields, this)
        el.on 'click', '.remove_fields',             $.proxy(@remove_fields, this)
        el.on 'change', 'select.ransack_predicate',  $.proxy(@predicate_changed, this)
        el.on 'change', 'select.ransack_attribute',  $.proxy(@attribute_changed, this)
        el.on 'change', 'input.ransack_query_multi', $.proxy(@multi_query_changed, this)
  
        # Store initial predicates and set up Select2 on select lists in .filters
        containers = el.find('.filters')
        @init_select2(containers)
        @store_initial_predicates(containers)
  
        # show spinner and disable the form when the search is underway
        el.find("form input:submit").click $.proxy(@form_submit, this)
  
        # Fire change event for any existing selects.
        el.find(".filters select").change()
  
      attribute_changed: (e) ->
        target = $(e.currentTarget)
  