change how tag counts are recalculated after a tag category changes

This commit is contained in:
albert
2013-03-12 12:26:25 -04:00
parent a6ed8bcaf1
commit 687a775fdf
4 changed files with 32 additions and 17 deletions

14
script/fixes/006.rb Normal file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
Post.where("created_at > '2013-02-01'").find_each do |post|
puts "Fixing #{post.id}"
post.reload
post.set_tag_counts
post.update_column(:tag_count, post.tag_count)
post.update_column(:tag_count_general, post.tag_count_general)
post.update_column(:tag_count_artist, post.tag_count_artist)
post.update_column(:tag_count_copyright, post.tag_count_copyright)
post.update_column(:tag_count_character, post.tag_count_character)
end