Skip to content

Commit f145657

Browse files
authored
Merge pull request #201 from joyofrails/feat/conditional-get-feed
Add conditional GET headers to feed response
2 parents bfe8a85 + 2a70ddc commit f145657

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/controllers/feed_controller.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
class FeedController < ApplicationController
22
def index
33
@articles = ArticlePage.published
4-
respond_to do |format|
5-
format.html { redirect_to feed_path(format: :atom), status: :moved_permanently }
6-
format.atom
4+
5+
if stale?(@articles, public: true)
6+
respond_to do |format|
7+
format.html { redirect_to feed_path(format: :atom), status: :moved_permanently }
8+
format.atom
9+
end
710
end
811
end
912
end

0 commit comments

Comments
 (0)