Ruby on rails Rails 3 Atom提要
正在尝试在Rails 3中创建Atom提要。当我刷新浏览器时,我看到的是基本的XML,而不是我正在寻找的Atom提要Ruby on rails Rails 3 Atom提要,ruby-on-rails,rss,atom-feed,Ruby On Rails,Rss,Atom Feed,正在尝试在Rails 3中创建Atom提要。当我刷新浏览器时,我看到的是基本的XML,而不是我正在寻找的Atom提要 class PostsController@posts} format.atom 结束 结束 index.atom.builder atom_feed do|feed| feed.title“twoconsortium feed” @posts.每个do | post| feed.entry(post)do | entry| entry.title post.title ent
class PostsController@posts}
format.atom
结束
结束
index.atom.builder
atom_feed do|feed|
feed.title“twoconsortium feed”
@posts.每个do | post|
feed.entry(post)do | entry|
entry.title post.title
entry.content post.text
结束
结束
结束
localhost:3000/posts.atom如下所示:
标签:localhost,2005:/posts
我的饲料
标签:localhost,2005:Post/1
2012-03-27T18:26:13Z
2012-03-27T18:26:13Z
第一个职位
好东西
标签:localhost,2005:Post/2
2012-03-27T19:51:18Z
2012-03-27T19:51:18Z
第二职位
这是第二类邮件
可能有助于在XHTML中格式化提要。我遇到了同样的问题
headers
散列中的响应头。只需添加带有典型Atom mime类型字符串的代码块:respond|to do |格式|
format.html#index.html.erb
format.xml{render:xml=>@posts}
format.atom{headers[“Content Type”]=“application/atom+xml;charset=utf-8'}
结束
对我来说就像一个atom提要。也许你只是缺少浏览器的阅读器?@defaye这可能是问题所在,我是chrome的,推荐的阅读器?perhaps@defaye谢谢,老兄,打得好。