Class: CreateAttrTranslations

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/attr_translatable/templates/create_attr_translations.rb

Class Method Summary collapse

Class Method Details

.changeObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/attr_translatable/templates/create_attr_translations.rb', line 4

def self.change
  create_table :attr_translations do |t|
    t.text        :translation
    t.string      :lang
    t.string      :attr
    t.references  :model, polymorphic: true
    t.timestamps
  end

  add_index :attr_translations, [:lang, :attr, :model_id, :model_type], unique: true, name: "index_attr_translations_on_attr_and_lang_and_model"
end