Class: CreateComments
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateComments
- Defined in:
- lib/generators/comments/templates/comments_table.rb
Instance Method Summary collapse
Instance Method Details
#down ⇒ Object
16 17 18 |
# File 'lib/generators/comments/templates/comments_table.rb', line 16 def down drop_table :comments end |
#up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/comments/templates/comments_table.rb', line 2 def up create_table :comments do |t| t.text :body t.references :user, index: true t.references :commentable, polymorphic: true t.string :group t.string :topic t. end add_index :comments, :commentable_type add_index :comments, :commentable_id end |