提交 745b7a14 编写于 作者: M Marc Chung

- Avoid using .first since it will create an additional query.

- Handle scenario where @posts is empty.
上级 5c61b723
...@@ -32,7 +32,7 @@ module AtomFeedHelper ...@@ -32,7 +32,7 @@ module AtomFeedHelper
# app/views/posts/index.atom.builder: # app/views/posts/index.atom.builder:
# atom_feed do |feed| # atom_feed do |feed|
# feed.title("My great blog!") # feed.title("My great blog!")
# feed.updated(@posts.first.created_at) # feed.updated(@posts[0].created_at) if @posts.length > 0
# #
# @posts.each do |post| # @posts.each do |post|
# feed.entry(post) do |entry| # feed.entry(post) do |entry|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册