def find_record(relation = nil)
      if locate_id.nil? || (locate_id.is_a?(::Numeric) && locate_id == 0) || (locate_id.to_s == '')
        return -1
      end

      dataset = load_records(relation, false)
      return -1 if dataset.blank?

      first_item = dataset.first
      klass = first_item.class

      id_field = klass.respond_to?('primary_key')       ? klass.primary_key   : nil
      id_field ||= first_item.respond_to?('id')         ? 'id'                : nil

      return -1 unless id_field
      if locate_id.is_a?(::Numeric)
        dataset.index{|item| item.send(id_field) == locate_id} || -1
      else
        loc_id = locate_id.to_s.downcase
        dataset.index{|item| item.send(id_field).to_s.downcase == loc_id} || -1
      end

    end
def find_record(relation = nil)
      if locate_id.nil? || (locate_id.is_a?(::Numeric) && locate_id == 0) || (locate_id.to_s == '')
        return -1
      end

      dataset = load_records(relation, false)
      return -1 if dataset.blank?

      first_item = dataset.first
      klass = first_item.class

      id_field = klass.respond_to?('primary_key')       ? klass.primary_key   : nil
      id_field ||= first_item.respond_to?('id')         ? 'id'                : nil

      return -1 unless id_field
      if locate_id.is_a?(::Numeric)
        dataset.index{|item| item.send(id_field) == locate_id} || -1
      else
        loc_id = locate_id.to_s.downcase
        dataset.index{|item| item.send(id_field).to_s.downcase == loc_id} || -1
      end

    end
Find the record represented by #locate_id.