Sha256: 6268fe8ecb53b6d7119e45324d491ceb9ff47f690cecd24520a2a30f5e64f99b

Contents?: true

Size: 618 Bytes

Versions: 1

Compression:

Stored size: 618 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 :attr, :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

1 entries across 1 versions & 1 rubygems

Version Path
teonimesic-translated_attributes-0.5.7 lib/generators/translated_attributes/templates/migration.rb