From ff8b9e6b08190c45ad1e0b7c33b5687f0b5cf56c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 17 Mar 2008 04:46:33 +0000 Subject: 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 --- actionpack/lib/action_view/helpers/atom_feed_helper.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/atom_feed_helper.rb b/actionpack/lib/action_view/helpers/atom_feed_helper.rb index aee709a116..5aaf1b4688 100644 --- a/actionpack/lib/action_view/helpers/atom_feed_helper.rb +++ b/actionpack/lib/action_view/helpers/atom_feed_helper.rb @@ -26,7 +26,7 @@ module ActionView # 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 ActionView # # The options for atom_feed are: # - # * :schema_date: 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. # * :language: Defaults to "en-US". # * :root_url: The HTML alternative that this feed is doubling for. Defaults to / on the current host. # * :url: The URL for this feed. Defaults to the current URL. + # * :schema_date: 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 ActionView # # 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) -- cgit v1.2.3