Sha256: 71c7ef29ccac5b8064a91664a6facf90861445675a8479a547776484c2e63c23

Contents?: true

Size: 533 Bytes

Versions: 6

Compression:

Stored size: 533 Bytes

Contents

# frozen_string_literal: true

namespace :decidim_initiatives do
  namespace :upgrade do
    desc "Fixes the broken pages"
    task fix_broken_pages: :environment do
      Decidim::Initiative.find_each do |initiative|
        initiative.components.where(manifest_name: "pages").each do |component|
          next unless Decidim::Pages::Page.where(component:).empty?

          Decidim::Pages::CreatePage.call(component) do
            on(:invalid) { raise "Cannot create page" }
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-initiatives-0.29.1 lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake
decidim-initiatives-0.29.0 lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake
decidim-initiatives-0.29.0.rc4 lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake
decidim-initiatives-0.29.0.rc3 lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake
decidim-initiatives-0.29.0.rc2 lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake
decidim-initiatives-0.29.0.rc1 lib/tasks/initiatives/upgrade/decidim_initiatives_upgrade_tasks.rake