Unless I'm overlooking something, it seems like you have some duplicate code in the video:
def comments Comment.where(commentable: commentable, parent_id: id) end def child_comments Comment.where(parent: self) end
While they use slightly different
where's the end result will be the same. The
commentable: commentable condition is unnecessary, as there should never exist a comment that has a different commentable than its parent.
Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.