diff --git a/config/initializers/acts_as_taggable_on.rb b/config/initializers/acts_as_taggable_on.rb index c8ebc9f6e..03f3f5efa 100644 --- a/config/initializers/acts_as_taggable_on.rb +++ b/config/initializers/acts_as_taggable_on.rb @@ -63,12 +63,6 @@ module ActsAsTaggableOn Tag.decrement_counter(custom_counter_field_name_for(taggable_type), id) end - def recalculate_custom_counter_for(taggable_type) - visible_taggables = taggable_type.constantize.includes(:taggings).where("taggings.taggable_type" => taggable_type, "taggings.tag_id" => id) - - update(custom_counter_field_name_for(taggable_type) => visible_taggables.count) - end - def self.category_names Tag.category.pluck(:name) end diff --git a/spec/lib/acts_as_taggable_on_spec.rb b/spec/lib/acts_as_taggable_on_spec.rb index 12521d67e..ef118c025 100644 --- a/spec/lib/acts_as_taggable_on_spec.rb +++ b/spec/lib/acts_as_taggable_on_spec.rb @@ -45,26 +45,6 @@ describe ActsAsTaggableOn do end describe "Tag" do - describe "#recalculate_custom_counter_for" do - it "updates the counters of proposals and debates, taking into account hidden ones" do - tag = Tag.create(name: "foo") - - create(:proposal, tag_list: "foo") - create(:proposal, :hidden, tag_list: "foo") - - create(:debate, tag_list: "foo") - create(:debate, :hidden, tag_list: "foo") - - tag.update(debates_count: 0, proposals_count: 0) - - tag.recalculate_custom_counter_for("Debate") - expect(tag.debates_count).to eq(1) - - tag.recalculate_custom_counter_for("Proposal") - expect(tag.proposals_count).to eq(1) - end - end - describe "public_for_api scope" do it "returns tags whose kind is NULL and have at least one tagging whose taggable is not hidden" do