From 1d45e28bd5dcff194da70ebed9e330ea48bfe9e6 Mon Sep 17 00:00:00 2001 From: Rocky Duan Date: Mon, 6 Aug 2012 22:25:57 -0400 Subject: [PATCH] removed actually useful code... --- models/comment_thread.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/models/comment_thread.rb b/models/comment_thread.rb index 445c746..8a228d5 100644 --- a/models/comment_thread.rb +++ b/models/comment_thread.rb @@ -66,6 +66,16 @@ class CommentThread < Content c end + def self.search_result_to_hash(result, params={}) + + comment_thread = self.find(result.id) + highlight = result.highlight || {} + + highlighted_body = (highlight[:body] || []).first || comment_thread.body + highlighted_title = (highlight[:title] || []).first || comment_thread.title + find(result.id).to_hash(params).merge(highlighted_body: highlighted_body, highlighted_title: highlighted_title) + end + def root_comments Comment.roots.where(comment_thread_id: self.id) end