Commit 9944acc5a675f234ac43df3087c4be4923901f1b
Committed by
Antonio Terceiro
1 parent
756c7f80
Exists in
master
and in
29 other branches
ActionItem1225: changing name of method
Showing
3 changed files
with
4 additions
and
4 deletions
Show diff stats
app/controllers/public/search_controller.rb
@@ -221,7 +221,7 @@ class SearchController < PublicController | @@ -221,7 +221,7 @@ class SearchController < PublicController | ||
221 | def tags | 221 | def tags |
222 | @tags_cache_key = "tags_env_#{environment.id.to_s}" | 222 | @tags_cache_key = "tags_env_#{environment.id.to_s}" |
223 | if is_cache_expired?(@tags_cache_key, true) | 223 | if is_cache_expired?(@tags_cache_key, true) |
224 | - @tags = environment.tags_count | 224 | + @tags = environment.tag_counts |
225 | end | 225 | end |
226 | end | 226 | end |
227 | 227 |
app/models/environment.rb
@@ -534,7 +534,7 @@ class Environment < ActiveRecord::Base | @@ -534,7 +534,7 @@ class Environment < ActiveRecord::Base | ||
534 | 534 | ||
535 | has_many :tags, :through => :articles | 535 | has_many :tags, :through => :articles |
536 | 536 | ||
537 | - def tags_count | 537 | + def tag_counts |
538 | options = Article.find_options_for_tag_counts.merge(:conditions => ['profiles.environment_id = ?', self.id]) | 538 | options = Article.find_options_for_tag_counts.merge(:conditions => ['profiles.environment_id = ?', self.id]) |
539 | options[:joins] = options[:joins] + ' LEFT OUTER JOIN profiles on profiles.id = articles.profile_id' | 539 | options[:joins] = options[:joins] + ' LEFT OUTER JOIN profiles on profiles.id = articles.profile_id' |
540 | Tag.find(:all, options).inject({}) do |memo,tag| | 540 | Tag.find(:all, options).inject({}) do |memo,tag| |
test/unit/environment_test.rb
@@ -811,7 +811,7 @@ class EnvironmentTest < Test::Unit::TestCase | @@ -811,7 +811,7 @@ class EnvironmentTest < Test::Unit::TestCase | ||
811 | user.articles.build(:name => 'article 2', :tag_list => 'first-tag, second-tag').save! | 811 | user.articles.build(:name => 'article 2', :tag_list => 'first-tag, second-tag').save! |
812 | user.articles.build(:name => 'article 3', :tag_list => 'first-tag, second-tag, third-tag').save! | 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 | end | 815 | end |
816 | 816 | ||
817 | should 'not list tags count from other environment' do | 817 | should 'not list tags count from other environment' do |
@@ -819,7 +819,7 @@ class EnvironmentTest < Test::Unit::TestCase | @@ -819,7 +819,7 @@ class EnvironmentTest < Test::Unit::TestCase | ||
819 | user = create_user('testinguser', :environment => e).person | 819 | user = create_user('testinguser', :environment => e).person |
820 | user.articles.build(:name => 'article 1', :tag_list => 'first-tag').save! | 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 | end | 823 | end |
824 | 824 | ||
825 | end | 825 | end |