Sha256: 293dbe637449c266d15f434fd8cb1232ed3d8ca3addf732da8eb6313ec5b17c7

Contents?: true

Size: 601 Bytes

Versions: 12

Compression:

Stored size: 601 Bytes

Contents

class CreateTranslationTables < ActiveRecord::Migration
  
  def self.globalizable_content
    Globalize2Extension::GLOBALIZABLE_CONTENT
  end
  
  def self.up
    globalizable_content.each do |model, columns|
      globalize_columns = {}
      columns.each do |column|
        base_column = model.columns.detect { |col| col.name == column.to_s } 
        globalize_columns[column] = base_column.type
      end
      model.create_translation_table! globalize_columns
    end
  end

  def self.down
    globalizable_content.each do |model, columns|
      model.drop_translation_table!
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
radiant-globalize2-extension-0.3.2 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.3.1 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.3.0 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.8 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.7 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.6 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.5 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.4 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.3 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.2 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.1 db/migrate/20090728084238_create_translation_tables.rb
radiant-globalize2-extension-0.2.0 db/migrate/20090728084238_create_translation_tables.rb