Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 9044

Show
Ignore:
Timestamp:
03/17/08 04:46:33 (5 months ago)
Author:
david
Message:

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]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_view/helpers/atom_feed_helper.rb

    r8637 r9044  
    2727      # 
    2828      #   app/views/posts/index.atom.builder: 
    29       #     atom_feed(:tag_uri => "2008") do |feed| 
     29      #     atom_feed do |feed| 
    3030      #       feed.title("My great blog!") 
    3131      #       feed.updated((@posts.first.created_at)) 
     
    4545      # The options for atom_feed are: 
    4646      # 
    47       # * <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. 
    4847      # * <tt>:language</tt>: Defaults to "en-US". 
    4948      # * <tt>:root_url</tt>: The HTML alternative that this feed is doubling for. Defaults to / on the current host. 
    5049      # * <tt>:url</tt>: The URL for this feed. Defaults to the current URL. 
     50      # * <tt>:schema_date</tt>: The date at which the tag scheme for the feed was first used. A good default is the year you  
     51      #   created the feed. See http://feedvalidator.org/docs/error/InvalidTAG.html for more information. If not specified,  
     52      #   2005 is used (as a "I don't care"-value). 
    5153      # 
    5254      # Other namespaces can be added to the root element: 
     
    7577      # atom_feed yields an AtomFeedBuilder instance. 
    7678      def atom_feed(options = {}, &block) 
    77         if options[:schema_date].blank? 
    78           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? 
     79        if options[:schema_date] 
     80          options[:schema_date] = options[:schema_date].strftime("%Y-%m-%d") if options[:schema_date].respond_to?(:strftime) 
    7981        else 
    80           options[:schema_date] = options[:schema_date].strftime("%Y-%m-%d") if options[:schema_date].respond_to?(:strftime) 
     82          options[:schema_date] = "2005" # The Atom spec copyright date 
    8183        end 
    8284