From 6ba4c6d497a71ee4b335898a6021124462b93724 Mon Sep 17 00:00:00 2001 From: Daniel Gomez de Souza Date: Sat, 10 Jan 2015 14:06:53 -0200 Subject: Use option url: false to allow entries without a link tag --- actionview/lib/action_view/helpers/atom_feed_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'actionview/lib/action_view/helpers') diff --git a/actionview/lib/action_view/helpers/atom_feed_helper.rb b/actionview/lib/action_view/helpers/atom_feed_helper.rb index 227ad4cdfa..d8be4e5678 100644 --- a/actionview/lib/action_view/helpers/atom_feed_helper.rb +++ b/actionview/lib/action_view/helpers/atom_feed_helper.rb @@ -174,7 +174,7 @@ module ActionView # # * :published: Time first published. Defaults to the created_at attribute on the record if one such exists. # * :updated: Time of update. Defaults to the updated_at attribute on the record if one such exists. - # * :url: The URL for this entry. Defaults to the polymorphic_url for the record. + # * :url: The URL for this entry or false or nil for not having a link tag. Defaults to the polymorphic_url for the record. # * :id: The ID for this entry. Defaults to "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}" # * :type: The TYPE for this entry. Defaults to "text/html". def entry(record, options = {}) @@ -191,7 +191,8 @@ module ActionView type = options.fetch(:type, 'text/html') - @xml.link(:rel => 'alternate', :type => type, :href => options[:url] || @view.polymorphic_url(record)) + url = options.fetch(:url) { @view.polymorphic_url(record) } + @xml.link(:rel => 'alternate', :type => type, :href => url) if url yield AtomBuilder.new(@xml) end -- cgit v1.2.3