ruby-on-rails – 如何在Rails 3中创建原子提要?

我正试图从我的Posts模型中设置一个简单的原子进给,我遇到了rails 2和rails 3之间的转换问题.

我尝试通过两个步骤完成此任务:

添加了<%= auto_discovery_link_tag(:atom)%>到我的/views/layouts/application.html.erb文件.

创建了/views/posts/index.atom.builder文件.该文件包含:

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

我在浏览器中看到了RSS链接,但链接打开时出现错误

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.

我哪里出错了?

解决方法

尝试指定Feed的路径:

<%= auto_discovery_link_tag(:atom,posts_path(:atom)) %>

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...