Posted By

rduv on 10/10/06


Tagged

rss


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

datorrey
adam_dc
webstic


atom template


 / Published in: Ruby
 

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

Report this snippet  

You need to login to post a comment.