diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-04-02 13:25:57 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-04-02 13:25:57 -0700 |
commit | 87b30fb2e6536b893b6cc2553dad89df8356d7bb (patch) | |
tree | bdd41cdfe51abc4a6d6bf125ed094538a851c005 /actionpack/lib/action_view/helpers/atom_feed_helper.rb | |
parent | 0b67751d62116a314d3d9c631d26d22dc0331067 (diff) | |
parent | e3d1585c8f2eb08e9e8bfa283a54a949f0ec5467 (diff) | |
download | rails-87b30fb2e6536b893b6cc2553dad89df8356d7bb.tar.gz rails-87b30fb2e6536b893b6cc2553dad89df8356d7bb.tar.bz2 rails-87b30fb2e6536b893b6cc2553dad89df8356d7bb.zip |
Merge pull request #5695 from lest/patch-1
add type option to atom feed entry builder
Diffstat (limited to 'actionpack/lib/action_view/helpers/atom_feed_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/atom_feed_helper.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/atom_feed_helper.rb b/actionpack/lib/action_view/helpers/atom_feed_helper.rb index 73824dc1f8..70164217de 100644 --- a/actionpack/lib/action_view/helpers/atom_feed_helper.rb +++ b/actionpack/lib/action_view/helpers/atom_feed_helper.rb @@ -176,6 +176,7 @@ module ActionView # * <tt>:updated</tt>: Time of update. Defaults to the updated_at attribute on the record if one such exists. # * <tt>:url</tt>: The URL for this entry. Defaults to the polymorphic_url for the record. # * <tt>:id</tt>: The ID for this entry. Defaults to "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}" + # * <tt>:type</tt>: The TYPE for this entry. Defaults to "text/html". def entry(record, options = {}) @xml.entry do @xml.id(options[:id] || "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}") @@ -188,7 +189,9 @@ module ActionView @xml.updated((options[:updated] || record.updated_at).xmlschema) end - @xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:url] || @view.polymorphic_url(record)) + type = options.fetch(:type) { 'text/html' } + + @xml.link(:rel => 'alternate', :type => type, :href => options[:url] || @view.polymorphic_url(record)) yield AtomBuilder.new(@xml) end |