Sha256: 685f6a38f3496d6c1ab76c21eb0b7788bd94bfb978f19ccd8793ee0148438923

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

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

class RenamingForMenu < Wagn::Migration
  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_referencers = 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

3 entries across 3 versions & 1 rubygems

Version Path
wagn-1.14.0.pre3 db/migrate_cards/20130411191151_renaming_for_menu.rb
wagn-1.14.0.pre2 db/migrate_cards/20130411191151_renaming_for_menu.rb
wagn-1.14.0.pre1 db/migrate_cards/20130411191151_renaming_for_menu.rb