Created
September 19, 2012 15:29
-
-
Save theotherzach/3750269 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.