Commit 3397f3b3

mo khan <mo@mokhan.ca>
2013-12-29 02:07:43
add cache-control and etags to tutorial tags.
1 parent a58d67b
app/controllers/creation_tags_controller.rb
@@ -11,6 +11,6 @@ class CreationTagsController < ApplicationController
     @total_creations = Creation.tagged_with(@tag).count
     @creations = Creation.includes([:user, :tags, :photos]).tagged_with([@tag]).where('photos_count > 0').page(params[:page]).per(15)
     expires_in(6.hours)
-    fresh_when(@tag)
+    fresh_when(@creations)
   end
 end
app/controllers/tutorial_tags_controller.rb
@@ -1,6 +1,8 @@
 class TutorialTagsController < ApplicationController
   def index
     @tags = Tutorial.tag_counts_on(:tags)
+    expires_in(6.hours)
+    fresh_when(@tags) if @tags.any?
   end
 
   def show
@@ -8,5 +10,7 @@ class TutorialTagsController < ApplicationController
     @total_tutorials = Tutorial.tagged_with(@tag).count
     @total_creations = Creation.tagged_with(@tag).count
     @tutorials = Tutorial.includes(:tags).tagged_with(@tag).page(params[:page]).per(15)
+    expires_in(6.hours)
+    fresh_when(@tutorials)
   end
 end