Sha256: 8692b2703801457d09ddc525bb121721aea59e61585e2e406cd7e0abf3b70fa6
Contents?: true
Size: 730 Bytes
Versions: 4
Compression:
Stored size: 730 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 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
4 entries across 4 versions & 1 rubygems