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.1.8 lib/tenon/can_have_comments.rb
tenon-1.1.7 lib/tenon/can_have_comments.rb
tenon-1.1.6 lib/tenon/can_have_comments.rb
tenon-1.1.5 lib/tenon/can_have_comments.rb
tenon-1.1.4 lib/tenon/can_have_comments.rb
tenon-1.1.3 lib/tenon/can_have_comments.rb
tenon-1.1.2 lib/tenon/can_have_comments.rb
tenon-1.1.1 lib/tenon/can_have_comments.rb
tenon-1.0.76 lib/tenon/can_have_comments.rb
tenon-1.0.75 lib/tenon/can_have_comments.rb
tenon-1.0.74 lib/tenon/can_have_comments.rb
tenon-1.0.73 lib/tenon/can_have_comments.rb
tenon-1.0.72 lib/tenon/can_have_comments.rb
tenon-1.0.71 lib/tenon/can_have_comments.rb
tenon-1.0.70 lib/tenon/can_have_comments.rb
tenon-1.0.69 lib/tenon/can_have_comments.rb
tenon-1.0.68 lib/tenon/can_have_comments.rb
tenon-1.0.67 lib/tenon/can_have_comments.rb
tenon-1.0.66 lib/tenon/can_have_comments.rb
tenon-1.0.65 lib/tenon/can_have_comments.rb