Sha256: 26af0098b8df6b9a47c96fceb52555a60ae41e114d6aa089a11973da7b735419

Contents?: true

Size: 527 Bytes

Versions: 1

Compression:

Stored size: 527 Bytes

Contents

# frozen_string_literal: true

require 'discourse_dev/record'
require 'rails'
require 'faker'

module DiscourseDev
  class Tag < Record

    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
    end

    def data
      {
        name: Faker::Discourse.unique.tag,
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse_dev-0.2.1 lib/discourse_dev/tag.rb