Sha256: 43a2f1edd00a6b9e46a9fdedd6bdd82d32a19bab60e177a162863405daa62f1b
Contents?: true
Size: 767 Bytes
Versions: 3
Compression:
Stored size: 767 Bytes
Contents
module Commontator class Subscription < ActiveRecord::Base belongs_to :subscriber, :polymorphic => true belongs_to :thread validates_presence_of :subscriber, :thread validates_uniqueness_of :thread_id, :scope => [:subscriber_type, :subscriber_id] 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) \ unless recipients.empty? end def unread_comments created_at = Comment.arel_table[:created_at] thread.filtered_comments.where(created_at.gt(updated_at)) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
commontator-5.1.0 | app/models/commontator/subscription.rb~ |
commontator-4.11.0 | app/models/commontator/subscription.rb~ |
commontator-4.10.4 | app/models/commontator/subscription.rb~ |