anchor.diff:        column_type = selected.data('type')
   
         base_id = target.attr('id').slice(0, -8)
  -      predicate_select  = this.element.find('select#' + base_id + 'p')
  -      predicate_select2 = this.element.find('#s2id_' + base_id + 'p')
  +      predicate_select  = @element.find('select#' + base_id + 'p')
  +      predicate_select2 = @element.find('#s2id_' + base_id + 'p')
         query_input = $('input#' + base_id + "v_0_value")
   
         # Initialize datepicker if column is date/datetime/time
  -      $.proxy(this.init_datetimepicker, this)(base_id)
  -
  +      $.proxy(@init_datetimepicker, this)(base_id)
  +
  +      # Handle association columns with AJAX autocomplete
         if selected.data('ajax-url') and Select2?
           controller = selected.data('controller')
   
  
positive.code:     options: {}
  
      _create: ->
        el = this.element
        el.on 'click', '.add_fields',       $.proxy(this.add_fields, this)
        el.on 'click', '.remove_fields',    $.proxy(this.remove_fields, this)
        el.on 'change', 'select.ransack_predicate', $.proxy(this.predicate_changed, this)
        el.on 'change', 'select.ransack_attribute', $.proxy(this.attribute_changed, this)
  
        # Set up Select2 on select lists in .filters
        this.init_select2(this.element.find('.filters'))
  
        # show spinner and disable the form when the search is underway
        el.find("form input:submit").click $.proxy(this.form_submit, this)
  
        # Fire change event for any existing selects.
        el.find(".filters select").change()
  
        # For basic search, remove placeholder text on focus, restore on blur
        $('#query').focusin (e) ->
          $(this).data('placeholder', $(this).attr('placeholder')).attr('placeholder', '')
        $('#query').focusout (e) ->
          $(this).attr('placeholder', $(this).data('placeholder'))
  
      predicate_changed: (e) ->
        target   = $(e.currentTarget)
        base_id = target.attr('id').slice(0, -1)
        query_input = $('input#' + base_id + "v_0_value")
        if target.val() in ["true", "false", "blank", "present", "null", "not_null"]
          query_input.val("true")
          query_input.hide()
          query_input.parent().find('.ui-datepicker-trigger').hide()
        else
          unless query_input.is(":visible")
            query_input.val("")
            query_input.show()
            query_input.parent().find('.ui-datepicker-trigger').show()
  
      attribute_changed: (e) ->
        target = $(e.currentTarget)
  
negative.code:         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.
  