parent
1fba78cd1a
commit
2fc0587b8c
@ -0,0 +1,10 @@
|
|||||||
|
class ModifyViewedCountForSubjects < ActiveRecord::Migration[5.2]
|
||||||
|
def change
|
||||||
|
|
||||||
|
subjects = Subject.where(status: 2).includes(:shixuns)
|
||||||
|
subjects.find_each do |subject|
|
||||||
|
subject.update_attribute(:visits, subject.visits + subject.shixuns.pluck(:myshixuns_count).sum)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue