Sha256: bfa2702304ea6f1aad5ab8272c4a93e33557ab36288695c9533f51b2e4bfd8a6

Contents?: true

Size: 497 Bytes

Versions: 6

Compression:

Stored size: 497 Bytes

Contents

# frozen_string_literal: true

class FixNilThresholdPerParagraph < ActiveRecord::Migration[5.1]
  class Component < ApplicationRecord
    self.table_name = :decidim_components
  end

  def change
    paragraph_components = Component.where(manifest_name: "paragraphs")

    paragraph_components.each do |component|
      settings = component.attributes["settings"]
      settings["global"]["threshold_per_paragraph"] ||= 0
      component.settings = settings
      component.save
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-enhanced_textwork-1.0.5 db/migrate/20180413135249_fix_nil_threshold_per_paragraph.rb
decidim-enhanced_textwork-1.0.4 db/migrate/20180413135249_fix_nil_threshold_per_paragraph.rb
decidim-enhanced_textwork-1.0.3 db/migrate/20180413135249_fix_nil_threshold_per_paragraph.rb
decidim-enhanced_textwork-1.0.2 db/migrate/20180413135249_fix_nil_threshold_per_paragraph.rb
decidim-enhanced_textwork-1.0.1 db/migrate/20180413135249_fix_nil_threshold_per_paragraph.rb
decidim-enhanced_textwork-1.0.0 db/migrate/20180413135249_fix_nil_threshold_per_paragraph.rb