Archives for May 2008
making it more convenient to be plural
May 23, 2008 by Eric Richardson
Hello again neglected blog...
Ever since the April 1st launch of the new blogdowntown code, there's been a sloppy little bug that's bothered me, but not quite been bad enough to address. When putting comment counts on stories, I got sloppy and wrote:
<%= thumbnail.comments.length %> Comments
instead of being proper and making sure account for the singular case. Bottom-line: the conditional is ugly. I didn't want to have to write this everywhere:
<%=
story.comments.length.to_s + " " +
(story.comments.length == 1) ? "Comment" : "Comments"
%>
So tonight I finally made the fix, but did it in a way that doesn't assault my senses. — Continue Reading...
Eric Richardson lives in Los Angeles, California, and is generally interested in the intersection between technology, community and news.
He started blogdowntown, an online news site for Downtown Los Angeles, and today works in digital media for Southern California Public Radio.
On This Date
- 2002
- The Strokes - Is This It
- furthurnet
- escripting.com
- 2001
- eThreads news
- fun with packet sniffing
- 2000
- if only they could see me now...
