Sha256: 678267b9b0ea68d919423a32ed255f7446953205655e1a5f70a7da790eb29439
Contents?: true
Size: 818 Bytes
Versions: 1
Compression:
Stored size: 818 Bytes
Contents
# frozen_string_literal: true require 'discourse_dev/record' require 'faker' module DiscourseDev class Topic < Record def initialize(count = DEFAULT_COUNT) super(::Topic, count) @category_ids = ::Category.pluck(:id) @user_count = ::User.count end def data { title: Faker::Lorem.sentence(word_count: 3, supplemental: true, random_words_to_add: 4).chomp(".")[0, SiteSetting.max_topic_title_length], raw: Faker::Markdown.sandwich(sentences: 5), category_id: @category_ids.sample, topic_opts: { custom_fields: { dev_sample: true } }, skip_validations: true } end def create! offset = rand(@user_count) user = ::User.offset(offset).first PostCreator.new(user, data).create! putc "." end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
discourse_dev-0.0.1 | lib/discourse_dev/topic.rb |