Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app/models/story.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ class Story < ActiveRecord::Base

UNTITLED = "[untitled]"

def fever_headline
self.title.nil? ? UNTITLED : strip_html(self.title)
end

def headline
self.title.nil? ? UNTITLED : strip_html(self.title)[0, 50]
fever_headline[0, 50]
end

def lead
Expand All @@ -31,7 +35,7 @@ def as_fever_json
{
id: self.id,
feed_id: self.feed.id,
title: headline,
title: fever_headline,
author: source,
html: body,
url: self.permalink,
Expand All @@ -45,4 +49,4 @@ def as_fever_json
def strip_html(contents)
Loofah.fragment(contents).text
end
end
end