I had the same problem with some of my projects, where some images or 
files had to be accessible only to logged users.

The solution is easy (I'm using file_column but the idea is the same), 
when you declare has_attachment you can also select where to save your 
files using :path_prefix .

You can set something like :path_prefix => "resources/#{table_name}" or 
some other non public directory to avoid accessing the files directly by 
passing a url.

To access the files, you call a method in a controller that serves back 
the file using the send_file function. Check the api for better info 
about it, you can send back the file inline (to be used in an image_tag 
for instance) or as a download.

Since the file is sent by a method, it's easy to prevent its download 
from non authorized user
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to