点击标签报错问题

This commit is contained in:
z9hang 2014-10-29 17:03:32 +08:00
parent b7cac9427b
commit 20e12327c4
1 changed files with 30 additions and 30 deletions

View File

@ -81,7 +81,7 @@ module ActsAsTaggableOn::Taggable
# User.tagged_with("awesome", "cool", :any => true) # Users that are tagged with awesome or cool
# User.tagged_with("awesome", "cool", :match_all => true) # Users that are tagged with just awesome and cool
# User.tagged_with("awesome", "cool", :owned_by => foo ) # Users that are tagged with just awesome and cool by 'foo'
def tagged_with(tags, options = {})
def tagged_with(tags,options = {},selected_tag_ids = nil)
tag_list = ActsAsTaggableOn::TagList.from(tags)
empty_result = where("1 = 0")
@ -154,9 +154,9 @@ module ActsAsTaggableOn::Taggable
else
tags = ActsAsTaggableOn::Tag.named_any(tag_list)
return empty_result unless tags.length == tag_list.length
#return empty_result unless tags.length == tag_list.length
tags.each do |tag|
next if selected_tag_ids && selected_tag_ids.count != 0 && !selected_tag_ids.include?(tag.id.to_s)
taggings_alias = adjust_taggings_alias("#{alias_base_name[0..11]}_taggings_#{sha_prefix(tag.name)}")
tagging_join = "JOIN #{ActsAsTaggableOn::Tagging.table_name} #{taggings_alias}" +
" ON #{taggings_alias}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" +