Sha256: f48726711f60a8eacf2668900676d22e9a04f245a8414a08373e489398681d05

Contents?: true

Size: 524 Bytes

Versions: 2

Compression:

Stored size: 524 Bytes

Contents

require "ancestry"

module CommentableOn
  class Comment < ::ActiveRecord::Base
    has_ancestry(primary_key_format: /\A[\w\-]+(\/[\w\-]+)*\z/, ancestry_column: :thread)

    if defined?(ProtectedAttributes)
      attr_accessible :commentable_id, :commentable_type, :commenter_id, :commenter_type, :commentable, :commenter, :body
    end

    belongs_to :commentable, polymorphic: true
    belongs_to :commenter, polymorphic: true

    validates_presence_of :commentable_id
    validates_presence_of :commenter_id
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
commentable_on-1.1.0 lib/commentable_on/comment.rb
commentable_on-1.0.0 lib/commentable_on/comment.rb