修改迁移文件2

This commit is contained in:
sylor_huang@126.com 2020-05-18 17:39:36 +08:00
parent fe0e2be00e
commit 29b8a92b9a
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ class ChangeProjectWatchersCount < ActiveRecord::Migration[5.2]
watcher_ids = Watcher.where(watchable_type: "Project").pluck(:watchable_id).uniq
watcher_ids.each do |i|
puts "#######____update_project_watchers_id____##############{i}"
p = Project.includes(:watchers).select(:id, :watchers_count).find_by(i)
p = Project.includes(:watchers).select(:id, :watchers_count).find_by(id:i)
if p.present?
Project.reset_counters(i, :watchers)
end