Sha256: 2486ef462affd8d912c448b4976a941f67b8626d48fd158b035d413f5e1f3c1c
Contents?: true
Size: 791 Bytes
Versions: 5
Compression:
Stored size: 791 Bytes
Contents
require 'active_support' module NotificationSettings module Subscribable extend ActiveSupport::Concern included do has_many :notification_subscriptions, as: :subscribable, class_name: 'NotificationSettings::Subscription', dependent: :destroy has_many :notification_subscribers, through: :notification_subscriptions, source: :subscriber include NotificationSettings::Subscribable::InstanceMethods end module InstanceMethods def notify_subscribers options = {} options[:object] = self self.notification_subscribers.each do |subscriber| subscriber.notify options end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems