Skip to content

Commit

Permalink
Quickly adding some simple client-side caching for images. [concerto#121
Browse files Browse the repository at this point in the history
]
  • Loading branch information
bamnet committed Nov 24, 2010
1 parent d26f1d8 commit 2089fb6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/controllers/contents_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ def destroy
# along for processing. Should send an inline result of the processing.
def display
@content = Content.find(params[:id])
@file = @content.render(params)
send_data @file.file_data, :filename => @file.file_name, :type => @file.file_type, :disposition => 'inline'
if stale?(:etag => params, :last_modified => @content.updated_at.utc, :public => true)
@file = @content.render(params)
send_data @file.file_data, :filename => @file.file_name, :type => @file.file_type, :disposition => 'inline'
end
end

end

0 comments on commit 2089fb6

Please sign in to comment.