ruby-on-rails-3builderatom-feedwebsubsuperfeedr

How can I add a link tag to the atom.builder feed generator?


In rails 3.0.9 (and maybe earlier) this code no longer works:

//feed.atom.builder
atom_feed :language => 'en-US' do |feed|
  feed.title @title
  feed.updated @updated
  feed.link('href' => 'http://[REDACTED].superfeedr.com/', 'rel' => "hub")
  ...
end

The exact error is: ArgumentError: wrong number of arguments (1 for 2) with a stack trace of:

/Users/[REDACTED]/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/fileutils.rb:302:in `ln'
[GEM_ROOT]@global/gems/rake-0.8.7/lib/rake.rb:1094:in `link'
[GEM_ROOT]/gems/actionpack-3.0.9/lib/action_view/helpers/atom_feed_helper.rb:146:in `method_missing'
app/views/feeds/index.atom.builder:4:in `block in _app_views_feeds_index_atom_builder___2426096422608134746_70129604713820_3077995114801777171'
[GEM_ROOT]/gems/actionpack-3.0.9/lib/action_view/helpers/atom_feed_helper.rb:123:in `block in atom_feed'
…

This is important for me and to setup a superfeedr Pubsubhubbub as described here. I need to get a <link rel="hub" … > tag into the atom feed but feed.link no longer works like it used to due to the method being removed from atom_feed_helper.rb. How can I get this link tag to show up again?


Solution

  • I believe you used this gem which seems a bit old, and since Atom is just a flavor of XML, it may be easier to just write the feed yourself anyway, using the answer given there.