Commit 48bf76107b590c56c8f1d8d02ae7ceed304fea6c
1 parent
d1342c85
Exists in
master
and in
29 other branches
rails3: adapt tag_counts method to the new tag plugin
Showing
1 changed file
with
1 additions
and
3 deletions
Show diff stats
app/models/environment.rb
@@ -640,9 +640,7 @@ class Environment < ActiveRecord::Base | @@ -640,9 +640,7 @@ class Environment < ActiveRecord::Base | ||
640 | has_many :tags, :through => :articles | 640 | has_many :tags, :through => :articles |
641 | 641 | ||
642 | def tag_counts | 642 | def tag_counts |
643 | - options = Article.find_options_for_tag_counts.merge(:conditions => ['profiles.environment_id = ?', self.id]) | ||
644 | - options[:joins] = options[:joins] + ' LEFT OUTER JOIN profiles on profiles.id = articles.profile_id' | ||
645 | - Tag.find(:all, options).inject({}) do |memo,tag| | 643 | + articles.tag_counts.inject({}) do |memo,tag| |
646 | memo[tag.name] = tag.count | 644 | memo[tag.name] = tag.count |
647 | memo | 645 | memo |
648 | end | 646 | end |