Sha256: 0731d51146899a59c3d480cf3a7a25b6af957f23be6394513c83ba7c5974892a

Contents?: true

Size: 825 Bytes

Versions: 43

Compression:

Stored size: 825 Bytes

Contents

# -*- encoding : utf-8 -*-

class FixModFiles < Card::Migration::Core
  def up
    Card.search(type: "image").each do |card|
      next unless card.coded?
      next unless card.db_content.include?("05_standard") ||
                  card.db_content.include?("06_bootstrap")
      new_content = card.db_content.sub("05_standard", "standard")
                        .sub("06_bootstrap", "bootstrap")
      card.update_column :db_content, new_content

      update_history card
    end
  end

  def update_history card
    card.actions.each do |action|
      next unless (content_change = action.change(:db_content))
      new_value = content_change.value.gsub("05_standard", "standard")
                                .gsub("06_bootstrap", "bootstrap")
      content_change.update_column :value, new_value
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
card-1.100.0 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.99.6 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.99.5 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.99.4 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.99.3 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.99.2 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.99.1 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.99.0 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.98.3 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.98.2 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.98.1 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.98.0 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.97.0.1 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.97.0 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.96.8 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.96.7 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.96.6 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.96.5 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.96.4 db/migrate_core_cards/20160914132636_fix_mod_files.rb
card-1.96.3 db/migrate_core_cards/20160914132636_fix_mod_files.rb