privacy translations in seed are being generated

This commit is contained in:
Jakub Krzus
2021-03-20 19:07:29 +00:00
parent c690635b6c
commit 44bec30bf8

View File

@@ -1,7 +1,16 @@
if SiteCustomization::Page.find_by(slug: "privacy").nil?
page = SiteCustomization::Page.new(slug: "privacy", status: "published")
page.print_content_flag = true
def generate_content(page)
page.title = I18n.t("pages.privacy.title")
page.content = I18n.t("pages.privacy.subtitle")
page.save!
end
if SiteCustomization::Page.find_by(slug: "privacy").nil?
page = SiteCustomization::Page.new(slug: "privacy", status: "published")
page.print_content_flag = true
generate_content(page)
I18n.available_locales.each do |locale|
I18n.locale = locale
translation = page.translations.build(locale: locale)
generate_content(translation)
end
end