def relation_primary_key(relation, source: nil, was: false)
      reflect = relation_reflect(relation)
      klass = nil
      if reflect.options.key?(:polymorphic)
        raise "can't handle multiple keys with polymorphic associations" unless (relation.is_a?(Symbol) || relation.length == 1)
        raise "must specify source for polymorphic associations..." unless source
        return relation_klass(relation, source: source, was: was).try(:primary_key)
      end
      reflect.association_primary_key(klass)
    end
def relation_primary_key(relation, source: nil, was: false)
      reflect = relation_reflect(relation)
      klass = nil
      if reflect.options.key?(:polymorphic)
        raise "can't handle multiple keys with polymorphic associations" unless (relation.is_a?(Symbol) || relation.length == 1)
        raise "must specify source for polymorphic associations..." unless source
        return relation_klass(relation, source: source, was: was).try(:primary_key)
      end
      reflect.association_primary_key(klass)
    end
gets the primary key name of the given relation

 relation: a symbol or array of symbols; specifies the relation
   that has the counter cache column
 source[optional]: the model instance that the relationship is linked from,
   only needed for polymorphic associations,
   probably only works with a single relation (symbol, or array of 1 symbol)
 was: boolean
   we're actually looking for the old value -- only can change for polymorphic relations