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
7 8 9 10 11 12 13 |
# File 'app/models/commontator/subscription.rb', line 7 def self.comment_created(comment) recipients = comment.thread.subscribers.reject { |sub| sub == comment.creator } return if recipients.empty? mail = Commontator::SubscriptionsMailer.comment_created(comment, recipients) mail.respond_to?(:deliver_later) ? mail.deliver_later : mail.deliver end |
Instance Method Details
#unread_comments(show_all) ⇒ Object
15 16 17 18 |
# File 'app/models/commontator/subscription.rb', line 15 def unread_comments(show_all) created_at = Commontator::Comment.arel_table[:created_at] thread.filtered_comments(show_all).where(created_at.gteq(updated_at)) end |