Permalink
Browse files

Merge branch 'feature/comparing' into develop

  • Loading branch information...
2 parents 302bd2e + 6a8cb38 commit d140f7eb9cdf94ea3e46c91e397cd76a901f0ba7 @acook committed Aug 16, 2011
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/acts_as_taggable_on/taggable/core.rb
@@ -85,8 +85,15 @@ def tagged_with(tags, options = {})
elsif options.delete(:any)
tags_conditions = tag_list.map { |t| sanitize_sql(["#{acts_as_taggable_on_tag_model.table_name}.name #{ActsAsTaggableOn.like_operator} ?", t]) }.join(" OR ")
- conditions << "#{table_name}.#{primary_key} IN (SELECT #{acts_as_taggable_on_tagging_model.table_name}.taggable_id FROM #{acts_as_taggable_on_tagging_model.table_name} JOIN #{acts_as_taggable_on_tag_model.table_name} ON #{acts_as_taggable_on_tagging_model.table_name}.tag_id = #{acts_as_taggable_on_tag_model.table_name}.id AND (#{tags_conditions}) WHERE #{acts_as_taggable_on_tagging_model.table_name}.taggable_type = #{quote_value(base_class.name)})"
+ conditions << " #{table_name}.#{primary_key} IN (" +
+ "SELECT #{acts_as_taggable_on_tagging_model.table_name}.taggable_id" +
+ " FROM #{acts_as_taggable_on_tagging_model.table_name}" +
+ " JOIN #{acts_as_taggable_on_tag_model.table_name}" +
+ " ON #{acts_as_taggable_on_tagging_model.table_name}.tag_id = #{acts_as_taggable_on_tag_model.table_name}.id" +
+ " AND (#{tags_conditions})" +
+ " WHERE #{acts_as_taggable_on_tagging_model.table_name}.taggable_type = #{quote_value(base_class.name)}" +
+ ")"
else
tags = acts_as_taggable_on_tag_model.named_any(tag_list)
return where("1 = 0") unless tags.length == tag_list.length

0 comments on commit d140f7e

Please sign in to comment.