Class: Commontator::Subscription
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Commontator::Subscription
- Defined in:
- app/models/commontator/subscription.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.comment_created(comment) ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/models/commontator/subscription.rb', line 9 def self.comment_created(comment) recipients = comment.thread.subscribers.reject{|s| s == comment.creator} return if recipients.empty? mail = SubscriptionsMailer.comment_created(comment, recipients) mail.respond_to?(:deliver_later) ? mail.deliver_later : mail.deliver end |
Instance Method Details
#unread_comments ⇒ Object
17 18 19 20 |
# File 'app/models/commontator/subscription.rb', line 17 def unread_comments created_at = Comment.arel_table[:created_at] thread.filtered_comments.where(created_at.gt(updated_at)) end |