Sha256: 34ae2618e4d5bbdab20122a3d63a04c6a02b803d46910ca55188494c988989eb

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

# encoding: utf-8

module PagesCore
  module PageModel
    module Commentable
      extend ActiveSupport::Concern

      included do
        has_many :comments, class_name: "PageComment", dependent: :destroy
      end

      def comments_closed_after_time?
        if PagesCore.config.close_comments_after.nil?
          false
        else
          (Time.now.utc - published_at) > PagesCore.config.close_comments_after
        end
      end

      def comments_allowed?
        if comments_closed_after_time?
          false
        else
          self[:comments_allowed]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pages_core-3.5.1 app/models/concerns/pages_core/page_model/commentable.rb