Module: Mongoid_Commentable::Comment

Extended by:
ActiveSupport::Concern
Included in:
Comment
Defined in:
lib/comment.rb

Instance Method Summary collapse

Instance Method Details

#deleted?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/comment.rb', line 25

def deleted?
  !!self.deleted_at
end

#levelObject



13
14
15
# File 'lib/comment.rb', line 13

def level
  path.count('.')
end

#removeObject



17
18
19
# File 'lib/comment.rb', line 17

def remove
  self.update_attribute(:deleted_at, Time.now)
end

#restoreObject



21
22
23
# File 'lib/comment.rb', line 21

def restore
  self.update_attribute(:deleted_at, nil)
end