Permalink
Browse files

Fixed that atom_feed shouldnt require a schema_date since most people…

… just dont care and the value tends to be of no significance anyway (references #10672) [DHH]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9044 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 9e45586 commit ff8b9e6b08190c45ad1e0b7c33b5687f0b5cf56c @dhh dhh committed Mar 17, 2008
Showing with 7 additions and 5 deletions.
  1. +7 −5 actionpack/lib/action_view/helpers/atom_feed_helper.rb
@@ -26,7 +26,7 @@ module AtomFeedHelper
# end
#
# app/views/posts/index.atom.builder:
- # atom_feed(:tag_uri => "2008") do |feed|
+ # atom_feed do |feed|
# feed.title("My great blog!")
# feed.updated((@posts.first.created_at))
#
@@ -44,10 +44,12 @@ module AtomFeedHelper
#
# The options for atom_feed are:
#
- # * <tt>:schema_date</tt>: Required. The date at which the tag scheme for the feed was first used. A good default is the year you created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information.
# * <tt>:language</tt>: Defaults to "en-US".
# * <tt>:root_url</tt>: The HTML alternative that this feed is doubling for. Defaults to / on the current host.
# * <tt>:url</tt>: The URL for this feed. Defaults to the current URL.
+ # * <tt>:schema_date</tt>: The date at which the tag scheme for the feed was first used. A good default is the year you
+ # created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified,
+ # 2005 is used (as a "I don't care"-value).
#
# Other namespaces can be added to the root element:
#
@@ -74,10 +76,10 @@ module AtomFeedHelper
#
# atom_feed yields an AtomFeedBuilder instance.
def atom_feed(options = {}, &block)
- if options[:schema_date].blank?
- logger.warn("You must provide the :schema_date option to atom_feed for your feed to be valid. A good default is the year you first created this feed.") unless logger.nil?
- else
+ if options[:schema_date]
options[:schema_date] = options[:schema_date].strftime("%Y-%m-%d") if options[:schema_date].respond_to?(:strftime)
+ else
+ options[:schema_date] = "2005" # The Atom spec copyright date
end
xml = options[:xml] || eval("xml", block.binding)

0 comments on commit ff8b9e6

Please sign in to comment.