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

#notify_authorObject



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

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

#notify_author?Boolean

Returns:

  • (Boolean)


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

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