Class: CreateLocalizedFields

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

Class Method Summary collapse

Class Method Details

.downObject



16
17
18
# File 'lib/generators/localized_fields/templates/migration.rb', line 16

def self.down
  drop_table :localized_fields
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/localized_fields/templates/migration.rb', line 2

def self.up
  create_table :localized_fields do |t|
    t.string :localized_object_type
    t.integer :localized_object_id
    t.string :locale
    t.string :field_name
    t.text :value
    #Any additional fields here

    t.timestamps
  end
  add_index :localized_fields,[:localized_object_type,:localized_object_id], :name => 'index_localized_fields_on_object_type_and_id'
end