Module: Juixe::Acts::Commentable::SingletonMethods
- Defined in:
- lib/acts_as_commentable.rb
Overview
This module contains class methods
Instance Method Summary (collapse)
-
- (Object) find_comments_for(obj)
Helper method to lookup for comments for a given object.
Instance Method Details
- (Object) find_comments_for(obj)
Helper method to lookup for comments for a given object. This method is equivalent to obj.comments.
22 23 24 25 26 27 28 29 |
# File 'lib/acts_as_commentable.rb', line 22 def find_comments_for(obj) commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s Comment.find(:all, :conditions => ["commentable_id = ? and commentable_type = ?", obj.id, commentable], :order => "created_at DESC" ) end |