Sha256: 9151bde243ef4d98732e337a69b2f8795cd905943e76464c43950b45673bb553

Contents?: true

Size: 380 Bytes

Versions: 1

Compression:

Stored size: 380 Bytes

Contents

class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
  def self.up
    add_column :tags, :taggings_count, :integer, :default => 0

    ActsAsTaggableOn::Tag.reset_column_information
    ActsAsTaggableOn::Tag.find_each do |tag|
      ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
    end
  end

  def self.down
    remove_column :tags, :taggings_count
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts-as-taggable-on-3.1.1 db/migrate/3_add_taggings_counter_cache_to_tags.rb