All Projects → rails → Atom_feed_helper

rails / Atom_feed_helper

Licence: mit
NOTICE: official repository moved to https://github.com/TrevorBramble/atom_feed_helper

Programming Languages

ruby
36898 projects - #4 most used programming language

AtomFeedHelper

Makes it easier to create atom feeds through Builder.

Example

from PostsController

def index @posts = Post.find(:all, :limit => 25)

respond_to do |format|
  format.html
  format.atom
end

end

from posts/index.atom.builder

atom_feed(:url => formatted_people_url(:atom)) do |feed| feed.title("Address book") feed.updated(@people.first ? @people.first.created_at : Time.now.utc)

for post in @posts
  feed.entry(post) do |entry|
    entry.title(post.title)
    entry.content(post.body, :type => 'html')

    entry.author do |author|
      author.name(post.creator.name)
      author.email(post.creator.email_address)
    end
  end
end

end

...returns:

tag:localhost:people <title>Address book</title> tag:localhost:3000,2007-05-18T16:35:00-07:00:Person1 2007-05-18T16:35:00-07:00 <title>The future is now</title> Once upon a time DHH [email protected] tag:localhost:3000,2007-05-18T09:36:00-07:00:Person2 2007-05-18T09:36:00-07:00 <title>Matz</title> This is Matz Matz Matz

Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].