Created
September 19, 2012 15:29
-
-
Save theotherzach/3750269 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Comment < ActiveRecord::Base | |
attr_accessible :subject, :body, :category, :reply_to | |
belongs_to :user | |
has_many :replies, :class_name => 'Comment', | |
:foreign_key => 'reply_to' | |
has_many :tags | |
scope :root, -> { where("reply_to = ?", 0 } | |
end | |
# Edited to rename Post to Comment |
We could do a placeholder, or just delete all sub comments as they would no longer make sense -- or we could not allow modifications of Comments once they've been commented on.
OR (yes, again), we could provide an option to do one of the three, and have it as an option settable by the Admin.
I feel pretty OK about child posts going away after the parent is deleted. I can't think of any commenting system off the top of my head that does anything else with orphans.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What should happen if a B posts a reply to A's Comment, and A subsequently deletes his?
We could keep the reply functionality by changing deleted Comments to a "The user deleted this post" placeholder, or else have suddenly orphaned Comments simply become autonomous replies to the Conversation-starting Comment.