Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove deprecated automatic counter caches on has_many :through
  • Loading branch information
rafaelfranca committed Jan 4, 2015
1 parent 37175a2 commit 87c8ce3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 40 deletions.
4 changes: 4 additions & 0 deletions activerecord/CHANGELOG.md
@@ -1,3 +1,7 @@
* Remove deprecated automatic counter caches on `has_many :through`.

*Rafael Mendonça França*

* Change the way in which callback chains can be halted.

The preferred method to halt a callback chain from now on is to explicitly
Expand Down
Expand Up @@ -49,16 +49,7 @@ def insert_record(record, validate = true, raise = false)
end

save_through_record(record)
if has_cached_counter? && !through_reflection_updates_counter_cache?
ActiveSupport::Deprecation.warn(<<-MSG.squish)
Automatic updating of counter caches on through associations has been
deprecated, and will be removed in Rails 5. Instead, please set the
appropriate `counter_cache` options on the `has_many` and `belongs_to`
for your associations to #{through_reflection.name}.
MSG

update_counter_in_database(1)
end
record
end

Expand Down Expand Up @@ -211,11 +202,6 @@ def find_target
def invertible_for?(record)
false
end

def through_reflection_updates_counter_cache?
counter_name = cached_counter_attribute_name
inverse_updates_counter_named?(counter_name, through_reflection)
end
end
end
end

This file was deleted.

0 comments on commit 87c8ce3

Please sign in to comment.