Allow undeleting comments

This commit is contained in:
Toks
2015-07-11 13:26:55 -04:00
parent fe7f3d8204
commit a4440514ff
5 changed files with 21 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ class Comment < ActiveRecord::Base
before_validation :initialize_updater
after_create :update_last_commented_at_on_create
after_destroy :update_last_commented_at_on_destroy
attr_accessible :body, :post_id, :do_not_bump_post
attr_accessible :body, :post_id, :do_not_bump_post, :is_deleted
module SearchMethods
def recent
@@ -175,6 +175,10 @@ class Comment < ActiveRecord::Base
def delete!
update_attributes(:is_deleted => true)
end
def undelete!
update_attributes(:is_deleted => false)
end
end
Comment.connection.extend(PostgresExtensions)