Method: ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder#entry
- Defined in:
- actionview/lib/action_view/helpers/atom_feed_helper.rb
#entry(record, options = {}) ⇒ Object
Creates an entry tag for a specific record and prefills the id using class and id.
Options:
-
: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 orfalse
ornil
for not having a link tag. Defaults to thepolymorphic_url
for the record. -
:id
: The ID for this entry. Defaults to “tag:#ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder.@[email protected]@view.request.host,#href=":schema_date">feed_options:#ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder.recordrecord.class/#ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder.recordrecord.id” -
:type
: The TYPE for this entry. Defaults to “text/html”.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'actionview/lib/action_view/helpers/atom_feed_helper.rb', line 180 def entry(record, = {}) @xml.entry do @xml.id([:id] || "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}") if [:published] || (record.respond_to?(:created_at) && record.created_at) @xml.published(([:published] || record.created_at).xmlschema) end if [:updated] || (record.respond_to?(:updated_at) && record.updated_at) @xml.updated(([:updated] || record.updated_at).xmlschema) end type = .fetch(:type, "text/html") url = .fetch(:url) { @view.polymorphic_url(record) } @xml.link(rel: "alternate", type: type, href: url) if url yield AtomBuilder.new(@xml) end end |