Commit 09f0f938

mo khan <mo@mokhan.ca>
2013-12-29 01:57:59
add cache-control and etag headers to profiles.
1 parent fd084d5
Changed files (1)
app
app/controllers/profiles_controller.rb
@@ -3,6 +3,8 @@ class ProfilesController < ApplicationController
 
   def index
     @profiles = User.includes(:avatar).where('creations_count > 0').order(:creations_count => :desc).page(params[:page]).per(12)
+    expires_in(1.hour)
+    fresh_when(User.maximum(:updated_at)) if User.any?
   end
 
   def show
@@ -13,6 +15,8 @@ class ProfilesController < ApplicationController
     @nearby_users.each do |user|
       @map_url += "&markers=#{user.latitude}%2C#{user.longitude}"
     end
+    expires_in(1.hour)
+    fresh_when(@user)
   end
 
   def favorites