Test if the label is valid before creating link

This commit is contained in:
Jacob Vosmaer
2014-08-19 18:20:42 +02:00
parent 71a674fd6a
commit 0920573ec5
@@ -18,7 +18,7 @@ class MigrateTaggableLabels < ActiveRecord::Migration
label_name = tagging.tag.name
label = target.project.labels.find_or_create_by(title: label_name)
if LabelLink.create(label: label, target: target)
if label.valid? && LabelLink.create(label: label, target: target)
print '.'
else
print 'F'