Sha256: 51c21f32d9d8a7125d6999a13203de6dfe53d64c2bd5c7306609f7fcb99c2b4e

Contents?: true

Size: 1.01 KB

Versions: 2

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: :destroy,
          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

2 entries across 2 versions & 1 rubygems

Version Path
yodeler-0.0.9 lib/yodeler/listens_to_yodeler.rb
yodeler-0.0.8 lib/yodeler/listens_to_yodeler.rb