Commit 9a6b90665d00c15018a44522657e757b055c0d23
1 parent
0f8cfad7
Exists in
master
and in
29 other branches
Added counter_sql on action_tracker_has_comments
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
vendor/plugins/action_tracker_has_comments/init.rb
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | |
3 | 3 | ActionTracker::Record.module_eval do |
4 | 4 | |
5 | - 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' | |
5 | + 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}' | |
6 | 6 | |
7 | 7 | def conditions_for_comments |
8 | 8 | type, id = (self.target_type == 'Article' ? ['Article', self.target_id] : [self.class.to_s, self.id]) | ... | ... |