How to create atom flow in Rails 3?

I am trying to configure a simple Atom stream from my message model, and I am facing translation problems between rails 2 and rails 3.

I tried to complete this task in two ways:

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

Created the file /views/posts/index.atom.builder. 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 am I wrong?

+4
source share
2 answers

Try specifying a feed path:

 <%= auto_discovery_link_tag(:atom, posts_path(:atom)) %> 
+7
source

Perhaps you need to provide the actual feed address?

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

If you use FeedBurner, you will want to use this address.

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

+2
source

Source: https://habr.com/ru/post/1335751/


All Articles