Skip to content

Commit

Permalink
applying DISTINCT clause only for many taggins contexts in tagged_wit…
Browse files Browse the repository at this point in the history
…h(:any => true)
  • Loading branch information
Rodrigo Panachi committed Sep 29, 2010
1 parent 208a1ef commit 7040626
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def tagged_with(tags, options = {})
" ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.id"

tagging_join << " AND " + sanitize_sql(["#{ActsAsTaggableOn::Tagging.table_name}.context = ?", context.to_s]) if context
select_clause = "DISTINCT #{table_name}.*" unless context
select_clause = "DISTINCT #{table_name}.*" unless context and tag_types.one?

joins << tagging_join

Expand Down

0 comments on commit 7040626

Please sign in to comment.