Ruby on Rails Monday, May 3, 2010

You could have PrivateImagesController with `show` method


and you will get your images through /private_images/image_name.png

in `show` method

    (check permissions)
    send_file "#{RAILS_ROOT}/private_images_folder/#{params[:image_name]}"


send_file is really slow and will work only when there's not a lot of users requesting files


In Nginx you could use x-send-file option or something, which makes send_file work much better. I didn't try that though. 

On Tue, May 4, 2010 at 1:08 AM, bill walton <bwalton.im@gmail.com> wrote:
I'm trying to display an image (chart) that lives outside the public
directory in RAILS_ROOT/private.

The chart contains confidential information and so can't live in /public
or any sub-directories of /public.

The chart needs to be displayed from a partial.  The first display of
the page containing the partial is an html render.  Subsequently, the
user can select a different chart causing an ajax call which replaces
the content of the image-containing dom element in the partial with a
new chart image.

Any thoughts / pointers are much appreciated!

Best regards,
Bill

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment