tags_conditions=tag_list.map{|t|sanitize_sql(["#{ActsAsTaggableOn::Tag.table_name}.name #{like_operator} ? ESCAPE '!'","%#{escape_like(t)}%"])}.join(" OR ")
else
tags_conditions=tag_list.map{|t|sanitize_sql(["#{ActsAsTaggableOn::Tag.table_name}.name #{like_operator} ?",t])}.join(" OR ")
end
conditions<<"#{table_name}.#{primary_key} NOT IN (SELECT #{ActsAsTaggableOn::Tagging.table_name}.taggable_id FROM #{ActsAsTaggableOn::Tagging.table_name} JOIN #{ActsAsTaggableOn::Tag.table_name} ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.#{ActsAsTaggableOn::Tag.primary_key} AND (#{tags_conditions}) WHERE #{ActsAsTaggableOn::Tagging.table_name}.taggable_type = #{quote_value(base_class.name,nil)})"