From 81ff121fe8564405f795c1c529771d92d6d9ec4c Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 28 Jul 2014 15:04:14 -0400 Subject: [PATCH] FIX: length error when seeding legal docs on a site with a low max post length --- db/fixtures/999_topics.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db/fixtures/999_topics.rb b/db/fixtures/999_topics.rb index 3a5454482d0..543f52f505f 100644 --- a/db/fixtures/999_topics.rb +++ b/db/fixtures/999_topics.rb @@ -25,13 +25,14 @@ end unless Rails.env.test? def create_static_page_topic(site_setting_key, title_key, body_key, body_override, category, description, params={}) unless SiteSetting.send(site_setting_key) > 0 - post = PostCreator.create( Discourse.system_user, + creator = PostCreator.new( Discourse.system_user, title: I18n.t(title_key, default: I18n.t(title_key, locale: :en)), raw: body_override.present? ? body_override : I18n.t(body_key, params.merge(default: I18n.t(body_key, params.merge(locale: :en)))), skip_validations: true, category: category ? category.name : nil) + post = creator.create - raise "Failed to create the #{description} topic! #{post.errors.full_messages.join('. ')}" unless post.valid? + raise "Failed to create the #{description} topic! #{creator.errors.full_messages.join('. ')}" if creator.errors.present? SiteSetting.send("#{site_setting_key}=", post.topic_id)