class ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder
:nodoc:
def entry(record, options = {})
* :id: The ID for this entry. Defaults to "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}"
* :url: The URL for this entry or +false+ or +nil+ for not having a link tag. Defaults to the +polymorphic_url+ for the record.
* :updated: Time of update. Defaults to the updated_at attribute on the record if one such exists.
* :published: Time first published. Defaults to the created_at attribute on the record if one such exists.
Options:
Creates an entry tag for a specific record and prefills the id using class and id.
def entry(record, options = {}) @xml.entry do @xml.id(options[:id] || "tag:#{@view.request.host},#{@feed_options[:schema_date]}:#{record.class}/#{record.id}") if options[:published] || (record.respond_to?(:created_at) && record.created_at) @xml.published((options[:published] || record.created_at).xmlschema) end if options[:updated] || (record.respond_to?(:updated_at) && record.updated_at) @xml.updated((options[:updated] || record.updated_at).xmlschema) end type = options.fetch(:type, "text/html") url = options.fetch(:url) { @view.polymorphic_url(record) } @xml.link(rel: "alternate", type: type, href: url) if url yield AtomBuilder.new(@xml) end end
def initialize(xml, view, feed_options = {})
def initialize(xml, view, feed_options = {}) @xml, @view, @feed_options = xml, view, feed_options end
def updated(date_or_time = nil)
def updated(date_or_time = nil) @xml.updated((date_or_time || Time.now.utc).xmlschema) end