Class: AddTranslations
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- AddTranslations
- Defined in:
- lib/generators/translated_attributes/templates/migration.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
15 16 17 |
# File 'lib/generators/translated_attributes/templates/migration.rb', line 15 def self.down drop_table :translations end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/generators/translated_attributes/templates/migration.rb', line 2 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 |