class Comment

Schema Information

Table name: comments

id               :integer          not null, primary key
user_id          :integer
body             :text
created_at       :datetime
updated_at       :datetime
commentable_id   :integer
university_id       :integer
commentable_type :string(255)
subject            :string(255)
parent_id        :integer
lft              :integer
rgt              :integer
comments_count   :integer          default(0)
deleted_at       :datetime

Public Instance Methods

set_commentable_for_child_comment() click to toggle source

Set parent as commentable.

# File app/models/comment.rb, line 46
def set_commentable_for_child_comment
  if self.parent
    self.commentable = parent.commentable
  end
end