diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2015-01-16 16:35:13 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2015-01-16 16:35:13 -0200 |
commit | fb82da305c971c4647007f85e2523e0772c43eae (patch) | |
tree | e44630dd7670d4dbe4c76143a19719a598115ffc /actionview/lib | |
parent | b74c3565cb08d6b011915c7c04c2f01fa1b78bf0 (diff) | |
parent | 6ba4c6d497a71ee4b335898a6021124462b93724 (diff) | |
download | rails-fb82da305c971c4647007f85e2523e0772c43eae.tar.gz rails-fb82da305c971c4647007f85e2523e0772c43eae.tar.bz2 rails-fb82da305c971c4647007f85e2523e0772c43eae.zip |
Merge pull request #18437 from eldano/feed_entry_no_link_option
Use option url: false to allow entries without a link tag
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/atom_feed_helper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
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 # # * <tt>:published</tt>: Time first published. Defaults to the created_at attribute on the record if one such exists. # * <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>:url</tt>: The URL for this entry or false or nil for not having a link tag. 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 = {}) @@ -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 |