修改迁移文件2
This commit is contained in:
parent
fe0e2be00e
commit
29b8a92b9a
|
@ -4,7 +4,7 @@ class ChangeProjectWatchersCount < ActiveRecord::Migration[5.2]
|
||||||
watcher_ids = Watcher.where(watchable_type: "Project").pluck(:watchable_id).uniq
|
watcher_ids = Watcher.where(watchable_type: "Project").pluck(:watchable_id).uniq
|
||||||
watcher_ids.each do |i|
|
watcher_ids.each do |i|
|
||||||
puts "#######____update_project_watchers_id____##############{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?
|
if p.present?
|
||||||
Project.reset_counters(i, :watchers)
|
Project.reset_counters(i, :watchers)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue