-
fix `test_counter_cache_column_update_on_destroy` for Rails 4.2 · 255a166d
This is a workaround actually. Since `ActiveRecord::CounterCache.each_counter_cached_associations` is private. We shouldn’t use it. Proposals for the proper fix are welcome. The reason the previous version stopped working is `affected_rows` returns `0` at [active_record/counter_cache.rb#L142](https://github.com/rails/rails/blo b/ef99d4cd3ecc58a8c1484740b2fb5447dbda23ab/activerecord/lib/active_recor d/counter_cache.rb#L142). If you follow the method call you’ll find that it’s called at [active_record/persistence.rb#L486](https://github.com/rails/rails/blob/ ef99d4cd3ecc58a8c1484740b2fb5447dbda23ab/activerecord/lib/active_record/ persistence.rb#L486). Probably we’d better override the return value in `ActiveRecord::Relation.delete_all` at [active_record/relation.rb#L481](https://github.com/rails/rails/blob/ef9 9d4cd3ecc58a8c1484740b2fb5447dbda23ab/activerecord/lib/active_record/rel ation.rb#L481).
Sergey Alekseev committed
Name |
Last commit
|
Last Update |
---|---|---|
.. | ||
paranoia | Loading commit data... | |
paranoia.rb | Loading commit data... |