socialforge/db/migrate/20160111080914_static_proje...

17 lines
369 B
Ruby
Raw Normal View History

2016-01-12 10:38:50 +08:00
class StaticProjectActs < ActiveRecord::Migration
def up
Project.all.each do |project|
acts = ForgeActivity.where("project_id = ?", project.id)
unless acts.blank?
2016-01-12 15:18:40 +08:00
count = acts.count
puts project.id
2016-01-12 15:18:40 +08:00
puts "acts_count is #{count}"
project.update_attribute(:acts_count, count)
end
2016-01-12 10:38:50 +08:00
end
end
def down
end
end