Class: Elabs::Comment
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Elabs::Comment
- Defined in:
- app/models/elabs/comment.rb
Instance Attribute Summary
Attributes inherited from ApplicationRecord
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_author ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/models/elabs/comment.rb', line 19 def 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
15 16 17 |
# File 'app/models/elabs/comment.rb', line 15 def user_id ? content.user_id != user_id : true end |