Since Q2OH is the Quote of Tomorrow, in the feed entry I add a day to the field that holds the day the quote was added to the feed. In the Domain Class Quote, qotd is a Date. Here is the entire code necessary to create the feed:
class FeedsController {
def rss = {
render(feedType:"rss", feedVersion:"2.0") {
title = "Q2OH >> Quote of Tomorrow"
link = "http://host:port/app/rss/feed"
description = "The Quote of Tomorrow"
Quote.findAllByQotdIsNotNull().each() { quote ->
entry("Quote for ${quote.qotd + 1}") {
link = "http://host:port/app/quote/display/${quote.id}"
author = quote.author
publishedDate = (java.util.Date) quote.qotd
quote.content // return the content
}
}
}
}
}
This results in an entry title of : Quote for Fri Nov 21 10:22:50 EST 2008
Originally the code was:
entry("Quote for ${quote.qotd}") {
That had an entry title of: Quote for 2008-11-20 10:22:50.0
So if you ask me, tomorrow looks better than today.
No comments:
Post a Comment