Sha256: f85fa7bdf02904c0a444d8a31f6688a266bd9c91c17523695a31a601ecb54029
Contents?: true
Size: 634 Bytes
Versions: 13
Compression:
Stored size: 634 Bytes
Contents
# frozen_string_literal: true module Talkie module ActsAsCommentable extend ActiveSupport::Concern module InstanceMethods def root_parents comments.where(parent_id: nil) end end module ClassMethods def acts_as_commentable has_many :comments, as: :commentable, class_name: "Talkie::Comment", inverse_of: :commentable include Talkie::ActsAsCommentable::InstanceMethods end alias_method :is_commentable, :acts_as_commentable end end end ActiveRecord::Base.send :include, Talkie::ActsAsCommentable
Version data entries
13 entries across 13 versions & 1 rubygems