Sha256: 0ca2bbc66e049ba8a287dc4511842f2ecf7a598c98865964d9839d3fe2cc389c

Contents?: true

Size: 376 Bytes

Versions: 33

Compression:

Stored size: 376 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

33 entries across 17 versions & 1 rubygems

Version Path
alchemy_cms-3.1.3 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.1 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.1 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.0.4 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.0.4 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.rc3 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.rc3 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.rc2 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.rc2 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.rc1 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.rc1 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.beta6 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.beta6 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.beta5 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.beta5 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.beta4 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.1.0.beta4 spec/dummy/db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb
alchemy_cms-3.0.3 db/migrate/20140701160159_add_taggings_counter_cache_to_tags.rb