| Class | ActionView::Helpers::AtomFeedHelper::AtomFeedBuilder |
| In: |
actionpack/lib/action_view/helpers/atom_feed_helper.rb
|
| Parent: | Object |
# File actionpack/lib/action_view/helpers/atom_feed_helper.rb, line 70 def initialize(xml, view) @xml, @view = xml, view end
Creates an entry tag for a specific record and prefills the id using class and id.
Options:
# File actionpack/lib/action_view/helpers/atom_feed_helper.rb, line 86 def entry(record, options = {}) @xml.entry do @xml.id("tag:#{@view.request.host_with_port}:#{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 @xml.link(:rel => 'alternate', :type => 'text/html', :href => options[:url] || @view.polymorphic_url(record)) yield @xml end end
Accepts a Date or Time object and inserts it in the proper format. If nil is passed, current time in UTC is used.
# File actionpack/lib/action_view/helpers/atom_feed_helper.rb, line 75 def updated(date_or_time = nil) @xml.updated((date_or_time || Time.now.utc).xmlschema) end