Test if the label is valid before creating link

This commit is contained in:
Jacob Vosmaer 2014-08-19 17:42:34 +02:00
parent 0b3ebb6440
commit 7e0a2b3b3d
1 changed files with 1 additions and 1 deletions

View File

@ -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'