Sha256: 5b9ab253383079cf67274582e2bbe197649f3cd80eecf8d5345bffb2424b3603

Contents?: true

Size: 1 KB

Versions: 7

Compression:

Stored size: 1 KB

Contents

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

class RenamingForMenu < Cardio::Migration::Core
  def up
    renames = {
      "*content" => "*structure",
      "*edit help" => "*help",
      "*links" => "*links to",
      "*inclusions" => "*includes",
      "*linkers" => "*linked to by",
      "*includers" => "*included by",
      "*plus cards" => "*children",
      "*plus parts" => "*mates",
      "*editing" => "*edited"
    }
    renames.each do |oldname, newname|
      puts "updating: #{oldname}"
      c = Card[oldname]
      c.update_referers = true
      c.name = newname
      c.save!
    end

    codenames = %w[
      by_name
      by_update
      by_create
      refers_to
      links_to
      includes
      referred_to_by
      linked_to_by
      included_by
      children
      mates
      editors
      discussion
      created
      edited
    ]
    codenames.each do |codename|
      name = codename =~ /^by|disc/ ? codename : "*#{codename}"
      c = Card[name]
      c.codename = codename
      c.save!
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
card-1.103.2 db/migrate_core_cards/20130411191151_renaming_for_menu.rb
card-1.103.1 db/migrate_core_cards/20130411191151_renaming_for_menu.rb
card-1.103.0 db/migrate_core_cards/20130411191151_renaming_for_menu.rb
card-1.101.7 db/migrate_core_cards/20130411191151_renaming_for_menu.rb
card-1.102.0 db/migrate_core_cards/20130411191151_renaming_for_menu.rb
card-1.101.6 db/migrate_core_cards/20130411191151_renaming_for_menu.rb
card-1.101.5 db/migrate_core_cards/20130411191151_renaming_for_menu.rb