refactored favorites

This commit is contained in:
r888888888
2013-04-18 20:19:11 -07:00
parent 9372219434
commit 00034f1a17
6 changed files with 38 additions and 20 deletions

9
script/fixes/013.rb Normal file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment'))
ActiveRecord::Base.connection.execute("set statement_timeout = 0")
Post.select("id, score, up_score, down_score, fav_count").find_each do |post|
post.update_column(:score, post.up_score - post.down_score + post.fav_count)
end