Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Like < ActiveRecord::Base
- belongs_to :likeable, :polymorphic => true
- belongs_to :profile
- end
- class Comment < ActiveRecord::Base
- #existing associations
- belongs_to :commentable, :polymorphic => true
- belongs_to :profile
- # need to associate through likeable_id/likeable_type
- end
- class Profile < ActiveRecord::Base
- #...
- has_many :likes
- #need to associate to liked_comments
- end
Add Comment
Please, Sign In to add comment