Class: Elabs::Comment

Inherits:
ApplicationRecord show all
Defined in:
app/models/elabs/comment.rb

Instance Attribute Summary

Attributes inherited from ApplicationRecord

#changed_by

Instance Method Summary collapse

Instance Method Details

#archive!Object



27
28
29
30
# File 'app/models/elabs/comment.rb', line 27

def archive!
  update(archived: true)
  notifications.destroy_all
end

#notify_authorObject



19
20
21
22
23
24
25
# File 'app/models/elabs/comment.rb', line 19

def notify_author
  notification = { content: self,
                   event:   :comment,
                   user_id: content.user_id }
  notification[:source_user] = user if user_id
  Elabs::Notification.create! notification
end

#notify_author?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'app/models/elabs/comment.rb', line 15

def notify_author?
  user_id ? content.user_id != user_id : true
end