Allow undeleting comments
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user