With edge rails (and maybe beta gems) you can do a
expires_in 1.day
(or 12.hours, 2.weeks, ...)
in your actions.
Here''s a snippet from my app:
def thumb
expires_in 1.day
send_file Document.find(params[:id]).path_to_thumbnail,
:type => ''image/jpeg'', :disposition =>
''inline''
end
I use this to be able to use Rails based authentification for
accessing the images.
Thomas
Am 26.08.2005 um 15:31 schrieb Kristof Jozsa:
> also, how can I disable adding the Cache-Control: no-cache http
> response header automatically when using send_file?
>
> Kristof Jozsa wrote:
>
>> Hi all,
>> is that ok that trying to stream down about 9 small pictures (at
>> size around 15-20k each) using send_file from the controller makes
>> the page get loaded in 4-5 seconds from localhost? Loading those
>> directly from public/ resulted in an instant load time. It''s
>> running on apache2 w/fastcgi and performance looks fine otherwise..
>> any ideas what can be wrong with my setup? maybe send_file is
>> *that* slow really? (I tried to play around the
''stream'' argument
>> but the results were about the same). I''ll try to get back
with
>> concrete numbers if I cannot find out what''s going on..
>> Suggestions very welcome :)
>> Kristof
>> _______________________________________________
>> Rails mailing list
>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>