Permalink
Browse files

Remove deprecated automatic counter caches on `has_many :through`

  • Loading branch information...
rafaelfranca committed Jan 4, 2015
1 parent 37175a2 commit 87c8ce340c6c83342df988df247e9035393ed7a0
@@ -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
@@ -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

@@ -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.

Oops, something went wrong.

0 comments on commit 87c8ce3

Please sign in to comment.