aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-05-20 15:48:24 +0200
committerGareth Rees <gareth@mysociety.org>2015-05-20 15:48:24 +0200
commit7c78a102bc83a5d52c3bb477676035e3b4db7dfc (patch)
tree8b3204a08ecf658381297056a868143ffcfcab5e /app
parentda706b6c05ee7d0be15b59cf0fdec7f6d3ed58ec (diff)
Add Comment#first_three_wordsuser_comment
This was a demo method for AlaveteliCon 2015
Diffstat (limited to 'app')
-rw-r--r--app/models/comment.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/comment.rb b/app/models/comment.rb
index ab4acfe56..415924fbb 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -82,6 +82,10 @@ class Comment < ActiveRecord::Base
end
end
+ def first_three_words
+ body.split.first(3).join(' ')
+ end
+
private
def check_body_has_content