Sha256: 127a40cfa6dbdd642fba9e5aae97844ca1c6524622cbe47b39ad59f288e7d10b

Contents?: true

Size: 636 Bytes

Versions: 2

Compression:

Stored size: 636 Bytes

Contents

class AddTranslations < ActiveRecord::Migration
  def self.up
    # you can remove the limit/null constrains
    # this is simply my recommended way of setting things up (save + limits needed storage space)
    create_table :translations do |t|
      t.integer :translatable_id, :null=>false
      t.string :translatable_type, :limit=>40, :null=>false
      t.string :language, :limit=>2, :null=>false
      t.string :translated_attribute, :limit=>40, :null=>false
      t.text :text, :null=>false
    end
    add_index :translations, [:translatable_id, :translatable_type]
  end

  def self.down
    drop_table :translations
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
translated_attributes-0.6.1 lib/generators/translated_attributes/templates/migration.rb
translated_attributes-0.6.0 lib/generators/translated_attributes/templates/migration.rb