Hi, My problem is similar to: http://groups.google.co.uk/group/rubyonrails-talk/browse_thread/thread/783a7821b13517ca/8c9543e2e6e79472?lnk=gst&q=outside+the+root&rnum=2&hl=en I am using attachment_fu to allows users to upload their own images. However I want to store them outside of my applications root. Then, when I ''cap deploy'', I wont wipe them all. I can then use :after_update_code to set a symlink and just update that with each deployment. Does anyone know of a solution? Rails seems to always look inside ''public/images'' and I know that you can use the plugin ''multi-asset-locations'' to set a particular asset_host for images but I didn''t quite understand how: :images => "http://images.domain.com" relates to a particular folder on the site?? Any nods in the right direction would be much appreciated. Cheers, Tim --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
What we did is wrote a simple controller that handles the mechanics of reading a binary file and pumping it out as the response. def get_asset asset = FileAsset.find(params[:id]) disposition = ''attachment'' if asset.mime_type == ''image/x-png'' or asset.mime_type == ''image/gif'' or asset.mime_type == ''image/jpeg'' : disposition = ''inline'' end send_file asset.file_path, :type => asset.mime_type, :disposition => disposition end On Aug 15, 2007, at 5:12 PM, fernando wrote:> > Hi, > My problem is similar to: > http://groups.google.co.uk/group/rubyonrails-talk/browse_thread/ > thread/783a7821b13517ca/8c9543e2e6e79472?lnk=gst&q=outside+the > +root&rnum=2&hl=en > > I am using attachment_fu to allows users to upload their own images. > However I want to store them outside of my applications root. Then, > when I ''cap deploy'', I wont wipe them all. I can then > use :after_update_code to set a symlink and just update that with each > deployment. > > Does anyone know of a solution? > Rails seems to always look inside ''public/images'' and I know that you > can use the plugin ''multi-asset-locations'' to set a particular > asset_host for images but I didn''t quite understand how: > :images => "http://images.domain.com" > relates to a particular folder on the site?? > > Any nods in the right direction would be much appreciated. > > Cheers, > Tim > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Just for other people suffering the same problem. I used a hack in the end to copy all the images from a folder in my application to one outside the application. THEN updated the code, THEN copied it back. All done using capistrano tasks: task :before_deploy do run "cp -r /home/domainName/appName/current/trunk/public/ image_uploads/* /home/domainName/image_backup/" end task :after_deploy, :roles => [:app, :db, :web] do run "cp -r /home/domainName/image_backup/* /home/domainName/appName/ current/trunk/public/image_uploads/" run "rm -rf /home/domainName/image_backup/*" end Hope someone finds that useful. On 15 Aug, 22:27, Paul Hoehne <phoe...-CEHHuaDLTIwbPXlZ+wYYRg@public.gmane.org> wrote:> What we did is wrote a simple controller that handles the mechanics > of reading a binary file and pumping it out as the response. > > def get_asset > asset = FileAsset.find(params[:id]) > disposition = ''attachment'' > if asset.mime_type == ''image/x-png'' or > asset.mime_type == ''image/gif'' or asset.mime_type == ''image/jpeg'' : > disposition = ''inline'' > end > send_file asset.file_path, :type => > asset.mime_type, :disposition => disposition > end > > On Aug 15, 2007, at 5:12 PM, fernando wrote: > > > > > Hi, > > My problem is similar to: > >http://groups.google.co.uk/group/rubyonrails-talk/browse_thread/ > > thread/783a7821b13517ca/8c9543e2e6e79472?lnk=gst&q=outside+the > > +root&rnum=2&hl=en > > > I am using attachment_fu to allows users to upload their own images. > > However I want to store them outside of my applications root. Then, > > when I ''cap deploy'', I wont wipe them all. I can then > > use :after_update_code to set a symlink and just update that with each > > deployment. > > > Does anyone know of a solution? > > Rails seems to always look inside ''public/images'' and I know that you > > can use the plugin ''multi-asset-locations'' to set a particular > > asset_host for images but I didn''t quite understand how: > > :images => "http://images.domain.com" > > relates to a particular folder on the site?? > > > Any nods in the right direction would be much appreciated. > > > Cheers, > > Tim--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---