Capistrano and uploads to the public directory

You'll want to create a shared dir in the system/shared directory capistrano sets up for you.

You can add this directory and make use of capistrano's callback, the after_update_code which runs after it checks out a new release into the releases dir to re-link this every time.

You can do something like this:

desc "Tasks to execute after code update" task :after_update_code, :roles => [:app, :db] do

  # relink a shared public directory   run "ln -nfs #{deploy_to}/#{shared_dir}/uploads #{release_path}/public/uploads" end

That way you now have a symlink similar to how it handles your log directory.

Hope that helps,

Capistrano automatically creates a symlink:

   RAILS_ROOT/public/system -> RAILS_ROOT/../shared/system

To build on this, I add symlinks to the repo, so in this case:

   RAILS_ROOT/public/uploads -> RAILS_ROOT/public/system/uploads

I them set svn:ignore on public to ignore 'system', and create a non- svn controlled directory in the working copy, in this case:

   mkdir -p RAILS_ROOT/public/system/uploads

I find this more convenient, reliable, and traceable than creating symlinks on-the-fly via Capistrano.

Charles' method is also perfectly reasonable.