aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/atom_feed_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-03-17 04:46:33 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-03-17 04:46:33 +0000
commitff8b9e6b08190c45ad1e0b7c33b5687f0b5cf56c (patch)
tree048c61ee19bc05eb607708ff8b84dec489a4f6fb /actionpack/lib/action_view/helpers/atom_feed_helper.rb
parent9e4558671c25f14950e21982ea93d5b977e9d2f8 (diff)
downloadrails-ff8b9e6b08190c45ad1e0b7c33b5687f0b5cf56c.tar.gz
rails-ff8b9e6b08190c45ad1e0b7c33b5687f0b5cf56c.tar.bz2
rails-ff8b9e6b08190c45ad1e0b7c33b5687f0b5cf56c.zip
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
Diffstat (limited to 'actionpack/lib/action_view/helpers/atom_feed_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/atom_feed_helper.rb12
1 files changed, 7 insertions, 5 deletions
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:
#
- # * <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 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)