Strip leading/trailing whitespace from comma-separated trace tags

This commit is contained in:
Anton Khorev 2022-07-19 13:47:28 +03:00
parent 48fff2bfea
commit b54c03389b
2 changed files with 17 additions and 2 deletions

View file

@ -57,7 +57,7 @@ class Trace < ApplicationRecord
def tagstring=(s)
self.tags = if s.include? ","
s.split(/\s*,\s*/).grep_v(/^\s*$/).collect do |tag|
s.split(",").map(&:strip).reject(&:empty?).collect do |tag|
tt = Tracetag.new
tt.tag = tag
tt