From 80937a838787df7bc092ecb1d5722f22c16e4718 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Fri, 7 May 2021 18:02:57 +0200 Subject: [PATCH] FIX: Retry creating tags (#8) In case there are any errors (i.e. name collision) --- lib/discourse_dev/tag.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/discourse_dev/tag.rb b/lib/discourse_dev/tag.rb index c4c43ae..987d865 100644 --- a/lib/discourse_dev/tag.rb +++ b/lib/discourse_dev/tag.rb @@ -11,6 +11,13 @@ def initialize super(::Tag, DiscourseDev.config.tag[:count]) end + def create! + super + rescue ActiveRecord::RecordInvalid => e + # If the name is taken, try again + retry + end + def populate! return unless SiteSetting.tagging_enabled super