From 66a32daa45656f32ed4685b0840ccaef841567f1 Mon Sep 17 00:00:00 2001 From: Michael Bensoussan Date: Mon, 6 Dec 2010 12:42:20 +0100 Subject: [PATCH] add is_comment_type method --- lib/commentable_methods.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/commentable_methods.rb b/lib/commentable_methods.rb index f066fd8..e95ce5b 100644 --- a/lib/commentable_methods.rb +++ b/lib/commentable_methods.rb @@ -43,6 +43,10 @@ def self.find_#{method_name}_by_user(user) Comment.where(["user_id = ? and commentable_type = ? and role = ?", user.id, commentable, "#{role.to_s}"]).order("created_at DESC") end + def is_comment_type?(type) + type.to_s == #{role.to_s} + end + def #{method_name}_ordered_by_submitted Comment.find_comments_for_commentable(self.class.name, id, "#{role.to_s}") end