Class: HearsayCreateReferences

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

Instance Method Summary collapse

Instance Method Details

#changeObject



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

def change
  create_table :references do |t|
    t.references :referencer, :polymorphic => true
    t.references :referenceable, :polymorphic => true
    t.string :attribute_name
    
    t.timestamps
  end
  add_index :references, [:referencer_id, :referencer_type]
  add_index :references, [:referenceable_id, :referenceable_type]
end