]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/trace.rb
Strip leading/trailing whitespace from comma-separated trace tags
[rails.git] / app / models / trace.rb
index 957bea8bc043429b5df7c72e3b0c97c55a86d87e..0b9877225b889c11d942aa1eb6f9b13feae8caec 100644 (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