Permalink
Browse files

ActsAsTaggableOn::Collection::ClassMethods#all_tag_counts: Select con…

…text, too.
  • Loading branch information...
1 parent 4690e04 commit 18e193ef575d11c2b49025989310c16a7879773f Torsten Schönebaum committed May 16, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb
@@ -89,8 +89,8 @@ def all_tag_counts(options = {})
].compact
## Generate scope:
- tagging_scope = ActsAsTaggableOn::Tagging.select("#{ActsAsTaggableOn::Tagging.table_name}.tag_id, COUNT(#{ActsAsTaggableOn::Tagging.table_name}.tag_id) AS tags_count")
- tag_scope = ActsAsTaggableOn::Tag.select("#{ActsAsTaggableOn::Tag.table_name}.*, #{ActsAsTaggableOn::Tagging.table_name}.tags_count AS count").order(options[:order]).limit(options[:limit])
+ tagging_scope = ActsAsTaggableOn::Tagging.select("#{ActsAsTaggableOn::Tagging.table_name}.tag_id, COUNT(#{ActsAsTaggableOn::Tagging.table_name}.tag_id) AS tags_count, #{ActsAsTaggableOn::Tagging.table_name}.context")
+ tag_scope = ActsAsTaggableOn::Tag.select("#{ActsAsTaggableOn::Tag.table_name}.*, #{ActsAsTaggableOn::Tagging.table_name}.tags_count AS count, #{ActsAsTaggableOn::Tagging.table_name}.context AS context").order(options[:order]).limit(options[:limit])
# Joins and conditions
tagging_joins.each { |join| tagging_scope = tagging_scope.joins(join) }
@@ -124,4 +124,4 @@ def tag_counts_on(context, options={})
end
end
end
-end
+end

0 comments on commit 18e193e

Please sign in to comment.