1 2 xml.instruct! 3 4 xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do 5 6 xml.title "Feed Name" 7 xml.link "rel" => "self", "href" => url_for(:only_path => false, :controller => 'feeds', :action => 'atom') 8 xml.link "rel" => "alternate", "href" => url_for(:only_path => false, :controller => 'posts') 9 xml.id url_for(:only_path => false, :controller => 'posts') 10 xml.updated @posts.first.updated_at.strftime "%Y-%m-%dT%H:%M:%SZ" if @posts.any? 11 xml.author { xml.name "Author Name" } 12 13 @posts.each do |post| 14 xml.entry do 15 xml.title post.title 16 xml.link "rel" => "alternate", "href" => url_for(:only_path => false, :controller => 'posts', :action => 'show', :id => post.id) 17 xml.id url_for(:only_path => false, :controller => 'posts', :action => 'show', :id => post.id) 18 xml.updated post.updated_at.strftime "%Y-%m-%dT%H:%M:%SZ" 19 xml.author { xml.name post.author.name } 20 xml.summary "Post summary" 21 xml.content "type" => "html" do 22 xml.text! render(:partial => "posts/post", :post => post) 23 end 24 end 25 end 26 27 end
You need to create an account or log in to post comments to this site.