lib/notification_settings/subscriber.rb in notification-settings-1.0.0.beta8 vs lib/notification_settings/subscriber.rb in notification-settings-1.0.0.beta9
- old
+ new
@@ -3,11 +3,10 @@
has_many :notification_subscriptions, as: :subscriber, class_name: 'NotificationSettings::Subscription', dependent: :destroy
has_many :notification_subscribables, through: :notification_subscriptions, source: :subscribable
def subscribe options = {}
- options[:subscriber] = self
- NotificationSettings::Subscription.create options
+ self.notification_subscriptions.create options
end
def unsubscribe subscribable
subscription = self.notification_subscriptions.find_by subscribable_id: subscribable.id, subscribable_type: subscribable.class.to_s
subscription.destroy