Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Removed call to AR::Base.class_name_of_active_record_descendant
Browse files Browse the repository at this point in the history
  • Loading branch information
CapyTheBeara committed Oct 28, 2010
1 parent 247df98 commit 0a8ed7d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/commentable_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ module SingletonMethods
# Helper method to lookup for comments for a given object.
# This method is equivalent to obj.comments.
def find_comments_for(obj)
commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
commentable = self.base_class.name
Comment.find_comments_for_commentable(commentable, obj.id)
end

# 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
def find_comments_by_user(user)
commentable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s
commentable = self.base_class.name
Comment.where(["user_id = ? and commentable_type = ?", user.id, commentable]).order("created_at DESC")
end
end
Expand Down

0 comments on commit 0a8ed7d

Please sign in to comment.