我的Atom Feed会自动生成我要删除的link
。我怎样才能做到这一点?这段代码:
atom_feed do |feed|
feed.title @client.name
@documents.each do |document|
feed.entry document, published: document.created_at do |entry|
entry.title document.title
entry.content document.message
entry.link share_url(@client.client_code, document.id)
entry.url share_url(@client.client_code, document.id)
entry.author @client.name
end
end
end
生成此Feed:
<entry>
<id>tag:localhost,2005:Document/2694</id>
<published>2014-04-25T11:36:34+10:00</published>
<updated>2014-05-01T09:27:16+10:00</updated>
<link rel="alternate" type="text/html" href="http://localhost:3000/documents/2694"/>
<title>April</title>
<content>Whatever.</content>
<link>http://localhost:3000/user/2694</link>
<url>http://localhost:3000/user/2694</url>
<author>User</author>
</entry>
这是我想删除(或至少更改过)的罪犯:
<link rel="alternate" type="text/html" href="http://localhost:3000/documents/2694"/>
有什么想法吗?感谢。
答案 0 :(得分:3)
解决。您可以将url
参数传递到feed
,如下所示:
...
feed.entry document, published: document.created_at, url: share_url(document.user.client_code, document.id) do |entry|
...