Module Acts::CommentableWithThreading::SingletonMethods
In: lib/acts_as_commentable_with_threading.rb

This module contains class methods

Methods

Public Instance methods

Helper class method to lookup comments for the mixin commentable type written by a given user. This method is NOT equivalent to Comment.find_comments_for_user

[Source]

    # File lib/acts_as_commentable_with_threading.rb, line 33
33:       def find_comments_by_user(user) 
34:         commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
35:         
36:         Comment.find(:all,
37:           :conditions => ["user_id = ? and commentable_type = ?", user.id, commentable],
38:           :order => "created_at DESC"
39:         )
40:       end

Helper method to lookup for comments for a given object. This method is equivalent to obj.comments.

[Source]

    # File lib/acts_as_commentable_with_threading.rb, line 21
21:       def find_comments_for(obj)
22:         commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
23:        
24:         Comment.find(:all,
25:           :conditions => ["commentable_id = ? and commentable_type = ?", obj.id, commentable],
26:           :order => "created_at DESC"
27:         )
28:       end

[Validate]