Commit fd084d5c

mo khan <mo@mokhan.ca>
2013-12-29 01:46:45
cache tutorials using cache-control headers and etag.
1 parent 0969fb8
Changed files (1)
app/controllers/tutorials_controller.rb
@@ -3,10 +3,14 @@ class TutorialsController < ApplicationController
 
   def index
     @tutorials = Tutorial.includes(:tags).page(params[:page]).per(15)
+    expires_in(10.minutes)
+    fresh_when(Tutorial.maximum(:updated_at)) if Tutorial.any?
   end
 
   def show
     @tutorial = Tutorial.find(params[:id])
+    expires_in(24.hours)
+    fresh_when(@tutorial)
   end
 
   def new