mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-13 10:54:23 +01:00
changed the parsing of a tag list to parse on comma in stead of comma-space. See #637. Thanks Hans!
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@708 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
e0ff27fd3b
commit
9973095133
1 changed files with 5 additions and 5 deletions
|
|
@ -8,8 +8,8 @@ class ActiveRecord::Base
|
|||
def tag_with(tags, user)
|
||||
Tag.transaction do
|
||||
Tagging.delete_all("taggable_id = #{self.id} and taggable_type = '#{self.class}' and user_id = #{user.id}")
|
||||
tags.downcase.split(", ").each do |tag|
|
||||
Tag.find_or_create_by_name(tag).on(self, user)
|
||||
tags.downcase.split(",").each do |tag|
|
||||
Tag.find_or_create_by_name(tag.strip).on(self, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -19,12 +19,12 @@ class ActiveRecord::Base
|
|||
end
|
||||
|
||||
def delete_tags tag_string
|
||||
split = tag_string.downcase.split(", ")
|
||||
tags.delete tags.select{|t| split.include? t.name}
|
||||
split = tag_string.downcase.split(",")
|
||||
tags.delete tags.select{|t| split.include? t.name.strip}
|
||||
end
|
||||
|
||||
def add_tag tag_name
|
||||
Tag.find_or_create_by_name(tag_name).on(self,user)
|
||||
Tag.find_or_create_by_name(tag_name.strip).on(self,user)
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue