Browse Source

修改迁移文件2

tags/v1
sylor_huang@126.com 6 years ago
parent
commit
29b8a92b9a
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      db/migrate/20200518092612_change_project_watchers_count.rb

+ 1
- 1
db/migrate/20200518092612_change_project_watchers_count.rb 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


Loading…
Cancel
Save