Open eduardm opened 8 years ago
Should work smoothly like normal
add_column :projects, :comments_count, :integer, :default => 0
Project.all.find_each do |p|
Project.update_counters p.id, :comments_count => p.root_comments.length
end
then in comment.rb
belongs_to :commentable, :polymorphic => true, :counter_cache => :comments_count
I think it will be useful to be able to use counter_cache with acts_as_commentable, could save a lot of processing time on large sites