fix tags case sensitivity

This commit is contained in:
Lee Lawlor 2015-02-17 09:03:00 -05:00
parent c5b6e16608
commit a63c2fa774

View File

@ -435,7 +435,7 @@ class Channel < ActiveRecord::Base
def remove_tags(tags) def remove_tags(tags)
tag_array = tags.split(',') tag_array = tags.split(',')
# remove white space # remove white space
tag_array = tag_array.collect {|t| t.strip } tag_array = tag_array.collect {|t| t.strip.downcase }
# get all taggings for this channel # get all taggings for this channel
taggings = Tagging.where(channel_id: self.id).includes(:tag) taggings = Tagging.where(channel_id: self.id).includes(:tag)
@ -443,7 +443,7 @@ class Channel < ActiveRecord::Base
# check for existence # check for existence
taggings.each do |tagging| taggings.each do |tagging|
# if tagging is not in list # if tagging is not in list
if !tag_array.include?(tagging.tag.name) if !tag_array.include?(tagging.tag.name.downcase)
# delete tagging # delete tagging
tagging.delete tagging.delete
end end