Sha256: 3a07bcdb20bf3cb797e7e305469db7db64a8dbe6ae68b3046b4e1d4c68bfad80
Contents?: true
Size: 737 Bytes
Versions: 12
Compression:
Stored size: 737 Bytes
Contents
class Commontator::Subscription < ActiveRecord::Base belongs_to :subscriber, polymorphic: true belongs_to :thread, inverse_of: :subscriptions validates :thread, presence: true, uniqueness: { scope: [ :subscriber_type, :subscriber_id ] } 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 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 end
Version data entries
12 entries across 12 versions & 1 rubygems