Class: FavorableMigration
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- FavorableMigration
- Defined in:
- lib/generators/templates/migrator.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
15 16 17 |
# File 'lib/generators/templates/migrator.rb', line 15 def self.down drop_table :favorites end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/generators/templates/migrator.rb', line 2 def self.up create_table :favorites do |t| t.references :favorable, polymorphic: true t.references :favoriter, polymorphic: true t. end add_index :favorites, [:favorable_id, :favorable_type] add_index :favorites, [:favoriter_id, :favoriter_type] end |