class StaticProjectActs < ActiveRecord::Migration def up Project.all.each do |project| acts = ForgeActivity.where("project_id = ?", project.id) unless acts.blank? count = acts.count puts project.id puts "acts_count is #{count}" project.update_attribute(:acts_count, count) end end end def down end end