Sha256: aa9ad5cb07cf059941cd4d00cbfd9218134ab75a61a27782420b58bfd5231f81

Contents?: true

Size: 428 Bytes

Versions: 83

Compression:

Stored size: 428 Bytes

Contents

module Tenon
  module CanHaveComments
    def self.included(mod)
      mod.extend(ClassMethods)
    end

    module ClassMethods
      def can_have_comments
        send(:has_many, :comments, as: :commentable, dependent: :destroy)
        send(:has_many, :subscribers, class_name: 'CommentSubscriber', as: :commentable, dependent: :destroy)
      end
    end
  end
end

ActiveRecord::Base.send(:include, Tenon::CanHaveComments)

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
tenon-1.0.43 lib/tenon/can_have_comments.rb
tenon-1.0.42 lib/tenon/can_have_comments.rb
tenon-1.0.41 lib/tenon/can_have_comments.rb
tenon-1.0.40 lib/tenon/can_have_comments.rb
tenon-1.0.39 lib/tenon/can_have_comments.rb
tenon-1.0.38 lib/tenon/can_have_comments.rb
tenon-1.0.37 lib/tenon/can_have_comments.rb
tenon-1.0.36 lib/tenon/can_have_comments.rb
tenon-1.0.35 lib/tenon/can_have_comments.rb
tenon-1.0.33 lib/tenon/can_have_comments.rb
tenon-1.0.32 lib/tenon/can_have_comments.rb
tenon-1.0.31 lib/tenon/can_have_comments.rb
tenon-1.0.30 lib/tenon/can_have_comments.rb
tenon-1.0.29 lib/tenon/can_have_comments.rb
tenon-1.0.28 lib/tenon/can_have_comments.rb
tenon-1.0.27 lib/tenon/can_have_comments.rb
tenon-1.0.26 lib/tenon/can_have_comments.rb
tenon-1.0.25 lib/tenon/can_have_comments.rb
tenon-1.0.24 lib/tenon/can_have_comments.rb
tenon-1.0.23 lib/tenon/can_have_comments.rb