Module: TraqHasComments::Commentable::SingletonMethods

Defined in:
lib/traq_has_comments/commentable.rb

Instance Method Summary collapse

Instance Method Details

#find_commentable(obj) ⇒ Object



30
31
32
# File 'lib/traq_has_comments/commentable.rb', line 30

def find_commentable(obj)
  obj.class.base_class.find(obj.id)
end

#find_comments_by_user(account, user) ⇒ Object



26
27
28
# File 'lib/traq_has_comments/commentable.rb', line 26

def find_comments_by_user(, user)
  HasComments::Comment.where(account_id: .id).where(user_id: user.id).order('created_at DESC')
end

#find_comments_for_commentable(account, obj) ⇒ Object



22
23
24
# File 'lib/traq_has_comments/commentable.rb', line 22

def find_comments_for_commentable(, obj)
  HasComments::Comment.where(account_id: .id).where(commentable_id: obj.id, commentable_type: obj.class.base_class).order('created_at DESC')
end