The migration code shown in this screencast does not work in Rails 2.0. Instead please use the code below. Special thanks to Josh Owens for this blog post describing the problem and solution.
migrations/006_add_tasks_count.rb
def self.up
add_column :projects, :tasks_count, :integer, :default => 0
Project.reset_column_information
Project.find(:all).each do |p|
Project.update_counters p.id, :tasks_count => p.tasks.length
end
end
def self.down
remove_column :projects, :tasks_count
end