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
#change ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/comments/templates/comments_table.rb', line 2 def change create_table :comments do |t| t.text :message t.references :user, index: true t.references :commentable, polymorphic: true t.string :groups t.string :mentions t. end add_index :comments, :commentable_type add_index :comments, :commentable_id add_index :comments, :user_id end |