rss_feed.rb
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class RssFeed < Article
# store setting in body
serialize Hash, :body
def body
self[:body] ||= {}
end
# TODO
def to_html
end
# RSS feeds have type =text/xml=.
def mime_type
'text/xml'
end
# FIXME - feed real data into the RSS feed
def data
result = ""
xml = Builder::XmlMarkup.new(:target => result)
xml.instruct! :xml, :version=>"1.0"
xml.rss(:version=>"2.0") do
xml.channel do
xml.title(_("%s's RSS feed") % (self.profile.name))
xml.link("http://www.yourDomain.com")
xml.description('Description here')
xml.language("pt_BR")
for article in profile.recent_documents(10)
xml.item do
xml.title(article.name)
xml.description(article.abstract)
# rfc822
xml.pubDate(article.created_on.rfc2822)
xml.link("http://www.yourDomain.com/linkToYourPost")
xml.guid("http://www.yourDomain.com/linkToYourPost")
end
end
end
end
result
end
end