counter_cache workaround for polymorphic associations on rails4