迁移点赞数

dev_course
daiao 5 years ago
parent 6f1d84eecc
commit f0b6c04e5f

@ -1,6 +1,6 @@
class ModifyPraisesCountForChallenges < ActiveRecord::Migration[5.2]
def change
challenges = Challenge.where(nil).unscope
challenges = Challenge.where(nil).unscoped
challenges.find_each do |c|
praises_count = c.praise_tread.where(praise_or_tread: 1).count
c.update_column(:praises_count, praises_count)
Loading…
Cancel
Save