Class: Commontator::Subscription

Inherits:
ActiveRecord::Base
  • Object
show all
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
# File 'app/models/commontator/subscription.rb', line 9

def self.comment_created(comment)
  recipients = comment.thread.subscribers.reject{|s| s == comment.creator}
  SubscriptionsMailer.comment_created(comment, recipients).deliver \
    unless recipients.empty?
end

Instance Method Details

#unread_commentsObject



15
16
17
18
# File 'app/models/commontator/subscription.rb', line 15

def unread_comments
  created_at = Comment.arel_table[:created_at]
  thread.filtered_comments.where(created_at.gt(updated_at))
end