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.22 lib/tenon/can_have_comments.rb
tenon-1.0.21 lib/tenon/can_have_comments.rb
tenon-1.0.20 lib/tenon/can_have_comments.rb
tenon-1.0.19 lib/tenon/can_have_comments.rb
tenon-1.0.18 lib/tenon/can_have_comments.rb
tenon-1.0.17 lib/tenon/can_have_comments.rb
tenon-1.0.16 lib/tenon/can_have_comments.rb
tenon-1.0.15 lib/tenon/can_have_comments.rb
tenon-1.0.14 lib/tenon/can_have_comments.rb
tenon-1.0.13 lib/tenon/can_have_comments.rb
tenon-1.0.12 lib/tenon/can_have_comments.rb
tenon-1.0.11 lib/tenon/can_have_comments.rb
tenon-1.0.10 lib/tenon/can_have_comments.rb
tenon-1.0.9 lib/tenon/can_have_comments.rb
tenon-1.0.8 lib/tenon/can_have_comments.rb
tenon-1.0.7 lib/tenon/can_have_comments.rb
tenon-1.0.6 lib/tenon/can_have_comments.rb
tenon-1.0.5 lib/tenon/can_have_comments.rb
tenon-1.0.4 lib/tenon/can_have_comments.rb
tenon-1.0.3 lib/tenon/can_have_comments.rb