From 3379f36b61e1f93c5ae0e3a394ca3440b4fe4497 Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Sat, 18 Dec 2010 08:59:58 -0500 Subject: [PATCH] Moved view logging to after the image is sent to improve performance. --- app/controllers/photos_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/photos_controller.rb b/app/controllers/photos_controller.rb index e700f6e..13f8cc5 100644 --- a/app/controllers/photos_controller.rb +++ b/app/controllers/photos_controller.rb @@ -19,9 +19,9 @@ class PhotosController < ApplicationController def show # Log the view @photo = Photo.find(params[:id]) - @photo.log_view # Get the image and send it to the browser data = File.open(@photo.photo.path, 'rb').read send_data(data , :filename => 'photo', :type => 'image/jpg', :disposition => 'inline') + @photo.log_view end end