I''m looking to make rss feeds of some of my controller data - what''s the simplest way to render some? Is there some way I can feed a json-like arrays of hashes type of structure in to some gem and get out an xml feed? Would it be more of a builder sort of operation? ? Jenna -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20111005/3ae70385/attachment.html>
There''s an RSS generator in the standard library.
So there is! Thanks Steve! ? Jenna On 05/10/2011, at 12:48 PM, Steve Klabnik wrote:> There''s an RSS generator in the standard library. > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20111005/1f8218b5/attachment.html>
On Wed, Oct 5, 2011 at 02:20, Jenna Fox <a at creativepony.com> wrote:> I''m looking to make rss feeds of some of my controller data - what''s the > simplest way to render some? Is there some way I can feed a json-like arrays > of hashes type of structure in to some gem and get out an xml feed? Would it > be more of a builder sort of operation? > > ? > JennaI haven''t tried the RSS generator, so I don''t know how well it works, but I''ve been doing this: https://github.com/judofyr/timeless/blob/master/timeless/views/feed.erb
On Wed, 5 Oct 2011 11:20:31 +1100, Jenna Fox <a at creativepony.com> wrote:> [1 <multipart/alternative (7bit)>] > [1.1 <text/plain; windows-1252 (quoted-printable)>] > > [1.2 <text/html; windows-1252 (quoted-printable)>] > I''m looking to make rss feeds of some of my controller data - what''s the > simplest way to render some? Is there some way I can feed a json-like arrays > of hashes type of structure in to some gem and get out an xml feed? Would it > be more of a builder sort of operation?An example. Succinct. RSS:Maker. For your reference. (from my blogging engine written with Camping 1.9): Firstly, need to require rss/maker, then module Blogg::Controllers class Index < R ''/'', ''/tag/([-\w]+)'', ''/(rss)'', ''/(rss)/([-\w]+)'' def get ( format=''html'', *rest ) ... then later on: # Produce RSS feed if format == ''rss'' content = RSS::Maker.make(''2.0'') do |m| m.channel.title = @@config[:title] m.channel.about = URL().to_s + ''/rss'' m.channel.link = URL().to_s m.channel.description = @@config[:descr] m.items.do_sort = true # sort items by date for post in @posts if post.okayed == true && tag_matches?(post, @tagg) i = m.items.new_item i.title = post.title i.link = URL(View, post.slug).to_s i.guid.content = URL(View, post.id).to_s i.guid.isPermaLink = true ar = post.body.split(/^---!/) i.description = RedCloth.new(ar[1]).to_html i.description << RedCloth.new(ar[2]).to_html if (ar[2] != nil && ar[2] != "\r\n" && ar[2] != "") i.date = post.when end end end r 200, content.to_s, ''Content-Type'' => ''application/rss+xml; charset=UTF-8'' Notes: I use ---! to mark a block at the beginning of a post - this block is the description of the post. Redcloth markdown is used. Cheers, Jonathan -- jjg: Jonathan J. Groll : groll co za has_one { :blog => "http://bloggroll.com" } Sent from my computer device which runs on free software
I was only once generating an RSS feed, and I just did it with Markaby. You can see live example here: http://warlightrss.heroku.com/general - and the source code: (RSS generation is at the very bottom) http://warlightrss.heroku.com/source/web.rb Also, don''t judge, this is old (still just works, so I didn''t mess with it for some time). ;) -- Matma Rex
That''s cool! :D ? Jenna On 06/10/2011, at 3:48 AM, Bartosz Dziewo?ski wrote:> I was only once generating an RSS feed, and I just did it with > Markaby. You can see live example here: > http://warlightrss.heroku.com/general - and the source code: (RSS > generation is at the very bottom) > http://warlightrss.heroku.com/source/web.rb > > Also, don''t judge, this is old (still just works, so I didn''t mess > with it for some time). ;) > > -- Matma Rex > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20111006/9cc1dabd/attachment.html>