Sha256: f83223c0d458e9bc71415bc1088f1449ed8f84c454e2d5b6217b9c7db2eb0ba9

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

module Yodeler
  module ListensToYodeler
    extend ActiveSupport::Concern
 
    included do
    end
 
    module ClassMethods
      def listens_to_yodeler(subscriptions_assocation_name = :yodeler_subscriptions, notifications_association_name = :yodeler_notifications)
        cattr_accessor :yodeler_subscriptions_name
        cattr_accessor :yodeler_notifications_name        
        self.yodeler_subscriptions_name = subscriptions_assocation_name
        self.yodeler_notifications_name = notifications_association_name

        has_many self.yodeler_subscriptions_name,
          dependent: :delete_all,
          class_name: "Yodeler::Subscription",
          foreign_key: :subscriber_id

        has_many self.yodeler_notifications_name,
          through: self.yodeler_subscriptions_name,
          foreign_key: :subscriber_id
         
        include Yodeler::ListensToYodeler::LocalInstanceMethods
      end
    end
 
    module LocalInstanceMethods;end;
  end
end
 
ActiveRecord::Base.send :include, Yodeler::ListensToYodeler

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yodeler-0.0.10 lib/yodeler/listens_to_yodeler.rb