Commit 9944acc5a675f234ac43df3087c4be4923901f1b

Authored by Daniela Feitosa
Committed by Antonio Terceiro
1 parent 756c7f80

ActionItem1225: changing name of method

app/controllers/public/search_controller.rb
... ... @@ -221,7 +221,7 @@ class SearchController < PublicController
221 221 def tags
222 222 @tags_cache_key = "tags_env_#{environment.id.to_s}"
223 223 if is_cache_expired?(@tags_cache_key, true)
224   - @tags = environment.tags_count
  224 + @tags = environment.tag_counts
225 225 end
226 226 end
227 227  
... ...
app/models/environment.rb
... ... @@ -534,7 +534,7 @@ class Environment < ActiveRecord::Base
534 534  
535 535 has_many :tags, :through => :articles
536 536  
537   - def tags_count
  537 + def tag_counts
538 538 options = Article.find_options_for_tag_counts.merge(:conditions => ['profiles.environment_id = ?', self.id])
539 539 options[:joins] = options[:joins] + ' LEFT OUTER JOIN profiles on profiles.id = articles.profile_id'
540 540 Tag.find(:all, options).inject({}) do |memo,tag|
... ...
test/unit/environment_test.rb
... ... @@ -811,7 +811,7 @@ class EnvironmentTest < Test::Unit::TestCase
811 811 user.articles.build(:name => 'article 2', :tag_list => 'first-tag, second-tag').save!
812 812 user.articles.build(:name => 'article 3', :tag_list => 'first-tag, second-tag, third-tag').save!
813 813  
814   - assert_equal({ 'first-tag' => 3, 'second-tag' => 2, 'third-tag' => 1 }, Environment.default.tags_count)
  814 + assert_equal({ 'first-tag' => 3, 'second-tag' => 2, 'third-tag' => 1 }, Environment.default.tag_counts)
815 815 end
816 816  
817 817 should 'not list tags count from other environment' do
... ... @@ -819,7 +819,7 @@ class EnvironmentTest < Test::Unit::TestCase
819 819 user = create_user('testinguser', :environment => e).person
820 820 user.articles.build(:name => 'article 1', :tag_list => 'first-tag').save!
821 821  
822   - assert_equal({}, Environment.default.tags_count)
  822 + assert_equal({}, Environment.default.tag_counts)
823 823 end
824 824  
825 825 end
... ...