Class: CreateFavorites
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateFavorites
- Defined in:
- lib/generators/favorite/templates/create_favorites.rb
Class Method Summary collapse
Class Method Details
.down ⇒ Object
15 16 17 |
# File 'lib/generators/favorite/templates/create_favorites.rb', line 15 def self.down drop_table :favorites end |
.up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/generators/favorite/templates/create_favorites.rb', line 2 def self.up create_table :favorites do |t| t.string :note, :limit => 50, :default => "" t.references :favable, :polymorphic => true t.references :user t. end add_index :favorites, :favable_type add_index :favorites, :favable_id add_index :favorites, :user_id end |