4

I'm trying to set up a simple atom feed from my Posts model and I'm running into translation problems between rails 2 and rails 3.

I tried to accomplish this task with two steps:

Added the <%= auto_discovery_link_tag(:atom) %> to my /views/layouts/application.html.erb file.

Created a /views/posts/index.atom.builder file. The file contains:

atom_feed do |feed|   
  feed.title("Daily Deal")   
  feed.updated(@posts.first.created_at)
  @posts.each do |post|
    feed.entry(post) do |entry|
      entry.title(post.title)
      entry.content(post.body, :type => 'html')
      entry.author { |author| author.name("Justin Zollars")}
    end
  end
end

I see the RSS link in my browser, but the link opens with an error:

  Too many redirects occurred trying to open
  “feed:http://localhost:3000/posts”.
  This might occur if you open a page
  that is redirected to open another
  page which then is redirected to open
  the original page.

Where have I gone wrong?

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
JZ.
  • 21,147
  • 32
  • 115
  • 192

2 Answers2

7

Try specifying a path to the feed:

<%= auto_discovery_link_tag(:atom, posts_path(:atom)) %>
John Topley
  • 113,588
  • 46
  • 195
  • 237
2

Maybe you need to specify the actual feed address?

auto_discovery_link_tag :atom, "http://mysite.com/posts.atom"

If you're using FeedBurner, you'll want to use that address instead.

Also, do you have some kind of before_filter blocking the access to that page?

monocle
  • 5,866
  • 2
  • 26
  • 22