Guest User

Untitled

a guest
May 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. # comments migration
  2. class CreateComments < ActiveRecord::Migration
  3. def change
  4. create_table :comments do |t|
  5. t.text :text
  6. t.integer :user_id
  7. t.integer :commentable_id
  8. t.string :commentable_type
  9.  
  10. t.timestamps
  11. end
  12.  
  13. add_index :comments, [:commentable_type, :commentable_id]
  14. end
  15. end
  16.  
  17. # comment model
  18.  
  19. module ActivityFusion
  20. class Comment < ActiveRecord::Base
  21. belongs_to :commentable, polymorphic: true
  22. end
  23. end
Add Comment
Please, Sign In to add comment