Note that the `sitemap:refresh` task only pings search engines at the end, so it only does so for the `Sitemap.default_host` defined last. So we're using the `sitemap:refresh:no_ping` task instead and pinging search engines after creating each sitemap. Note we're pinging search engines in staging and preproduction environments. I'm leaving it that way because that's what we've done until now, but I wonder whether we should only do so on production. Since we're creating a new method to get the current url_options, we're also using it in the dev_seeds.
37 lines
1.2 KiB
Ruby
37 lines
1.2 KiB
Ruby
section "Creating Admin Notifications & Templates" do
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.proposal.#{attribute}") }
|
|
end
|
|
).merge(
|
|
link: Rails.application.routes.url_helpers.proposals_url(Tenant.current_url_options),
|
|
segment_recipient: "administrators"
|
|
)
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.help.#{attribute}") }
|
|
end
|
|
).merge(link: "https://crwd.in/consul", segment_recipient: "administrators")
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.map.#{attribute}") }
|
|
end
|
|
).merge(segment_recipient: "administrators")
|
|
).deliver
|
|
|
|
AdminNotification.create!(
|
|
random_locales_attributes(
|
|
%i[title body].index_with do |attribute|
|
|
-> { I18n.t("seeds.admin_notifications.budget.#{attribute}") }
|
|
end
|
|
).merge(segment_recipient: "administrators", sent_at: nil)
|
|
)
|
|
end
|