0
@@ -17,7 +17,7 @@ module ActionView
0
# @posts = Post.find(:all)
0
# respond_to do |format|
0
@@ -29,12 +29,12 @@ module ActionView
0
# feed.title("My great blog!")
0
# feed.updated((@posts.first.created_at))
0
# feed.entry(post) do |entry|
0
# entry.title(post.title)
0
# entry.content(post.body, :type => 'html')
0
# entry.author do |author|
0
@@ -47,8 +47,9 @@ module ActionView
0
# * <tt>:language</tt>: Defaults to "en-US".
0
# * <tt>:root_url</tt>: The HTML alternative that this feed is doubling for. Defaults to / on the current host.
0
# * <tt>:url</tt>: The URL for this feed. Defaults to the current URL.
0
- # * <tt>:schema_date</tt>: The date at which the tag scheme for the feed was first used. A good default is the year you
0
- # created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified,
0
+ # * <tt>:id</tt>: The id for this feed. Defaults to "tag:#{request.host},#{options[:schema_date]}:#{request.request_uri.split(".")[0]}"
0
+ # * <tt>:schema_date</tt>: The date at which the tag scheme for the feed was first used. A good default is the year you
0
+ # created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified,
0
# 2005 is used (as an "I don't care" value).
0
# Other namespaces can be added to the root element:
0
@@ -81,7 +82,7 @@ module ActionView
0
options[:schema_date] = "2005" # The Atom spec copyright date
0
xml = options[:xml] || eval("xml", block.binding)
0
@@ -89,10 +90,10 @@ module ActionView
0
feed_opts.merge!(options).reject!{|k,v| !k.to_s.match(/^xml/)}
0
- xml.id(
"tag:#{request.host},#{options[:schema_date]}:#{request.request_uri.split(".")[0]}") 0
+ xml.id(
options[:id] || "tag:#{request.host},#{options[:schema_date]}:#{request.request_uri.split(".")[0]}")0
xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:root_url] || (request.protocol + request.host_with_port))
0
xml.link(:rel => 'self', :type => 'application/atom+xml', :href => options[:url] || request.url)
0
yield AtomFeedBuilder.new(xml, self, options)
0
@@ -102,7 +103,7 @@ module ActionView
0
def initialize(xml, view, feed_options = {})
0
@xml, @view, @feed_options = xml, view, feed_options
0
# Accepts a Date or Time object and inserts it in the proper format. If nil is passed, current time in UTC is used.
0
def updated(date_or_time = nil)
0
@xml.updated((date_or_time || Time.now.utc).xmlschema)
0
@@ -115,9 +116,10 @@ module ActionView
0
# * <tt>:published</tt>: Time first published. Defaults to the created_at attribute on the record if one such exists.
0
# * <tt>:updated</tt>: Time of update. Defaults to the updated_at attribute on the record if one such exists.
0
# * <tt>:url</tt>: The URL for this entry. Defaults to the polymorphic_url for the record.
0
+ # * <tt>:id</tt>: The ID for this entry. Defaults to "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}"
0
def entry(record, options = {})
0
- @xml.id("tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}")
0
+ @xml.id(options[:id] || "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}")
0
if options[:published] || (record.respond_to?(:created_at) && record.created_at)
0
@xml.published((options[:published] || record.created_at).xmlschema)
thanks!