class StaticProjectBoards < ActiveRecord::Migration def up Project.all.each do |project| puts project.id unless project.boards.first.nil? boards_count = project.boards.first.topics.count project.update_attribute(:boards_count, boards_count) end end end def down end end