From 48bf76107b590c56c8f1d8d02ae7ceed304fea6c Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Fri, 17 Jan 2014 16:21:38 -0300 Subject: [PATCH] rails3: adapt tag_counts method to the new tag plugin --- app/models/environment.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/models/environment.rb b/app/models/environment.rb index 424aa62..bf2712d 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -640,9 +640,7 @@ class Environment < ActiveRecord::Base has_many :tags, :through => :articles def tag_counts - options = Article.find_options_for_tag_counts.merge(:conditions => ['profiles.environment_id = ?', self.id]) - options[:joins] = options[:joins] + ' LEFT OUTER JOIN profiles on profiles.id = articles.profile_id' - Tag.find(:all, options).inject({}) do |memo,tag| + articles.tag_counts.inject({}) do |memo,tag| memo[tag.name] = tag.count memo end -- libgit2 0.21.2