Permalink
Browse files

Merge pull request #244 from twinturbo/group_by_having

Close #242
  • Loading branch information...
2 parents 9d199e3 + d7a2985 commit 757aeac1e83d161e81e1a384860d2674f135e58d @artemk artemk committed Jul 9, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
@@ -166,12 +166,14 @@ def tagged_with(tags, options = {})
group_columns = ActsAsTaggableOn::Tag.using_postgresql? ? grouped_column_names_for(self) : "#{table_name}.#{primary_key}"
- group = "#{group_columns} HAVING COUNT(#{taggings_alias}.taggable_id) = #{tags.size}"
+ group = group_columns
+ having = "COUNT(#{taggings_alias}.taggable_id) = #{tags.size}"
end
scoped(:select => select_clause,
:joins => joins.join(" "),
:group => group,
+ :having => having,
:conditions => conditions.join(" AND "),
:order => options[:order],
:readonly => false)

0 comments on commit 757aeac

Please sign in to comment.