From 9a6b90665d00c15018a44522657e757b055c0d23 Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Tue, 28 Feb 2012 12:38:20 -0300 Subject: [PATCH] Added counter_sql on action_tracker_has_comments --- vendor/plugins/action_tracker_has_comments/init.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/plugins/action_tracker_has_comments/init.rb b/vendor/plugins/action_tracker_has_comments/init.rb index a41310e..9ad3408 100644 --- a/vendor/plugins/action_tracker_has_comments/init.rb +++ b/vendor/plugins/action_tracker_has_comments/init.rb @@ -2,7 +2,7 @@ ActionTracker::Record.module_eval do - has_many :comments, :class_name => 'Comment', :foreign_key => 'source_id', :dependent => :destroy, :finder_sql => 'SELECT * FROM comments WHERE #{conditions_for_comments} ORDER BY created_at ASC' + has_many :comments, :class_name => 'Comment', :foreign_key => 'source_id', :dependent => :destroy, :finder_sql => 'SELECT * FROM comments WHERE #{conditions_for_comments} ORDER BY created_at ASC', :counter_sql => 'SELECT * FROM comments WHERE #{conditions_for_comments}' def conditions_for_comments type, id = (self.target_type == 'Article' ? ['Article', self.target_id] : [self.class.to_s, self.id]) -- libgit2 0.21.2