Richard Sandilands wrote:
Hi there
I have a Rails app which requires the client to upload image files to
a certain directory.
I'm using capistrano to deploy and have created a directory in shared:
shared/book_images
I want to symlink this to my_rails_app/public/images/book_images and
have this task in my deploy.rb file:
desc "Link to the book images directory where uploads go"
task :after_symlink do
run "ln -nfs #{shared_dir}/book_images
#{release_path}/public/images/book_images"
end
However, iif I ssh into the current release, I see that the symlink
above is incorrect: the symlink to the shared book_images directory is
_inside_ of public/images/book_images
that is, I end up with public/images/book_images/book_images
Any clues on how to resolve this would be appreciated.
Does your release_path/public already contain an images/book_images directory *before* you symlink? I seem to remember having a similar problem and it was because I already had a public/photos directory in subversion and so when I deployed the app and then tried to link public/photos to shared/photos, I remember something screwy happening. My quicky hack workaround was to delete the real directory before I did the symlink, i.e.:
task :after_update_code, :roles => :app do
run "rm -rf #{release_path}/public/photos"
run "ln -nfs #{shared_path}/photos #{release_path}/public/photos"
end
HTH,
Jamey
Confidentiality Notice: This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and/or privileged information. If you are not the intended recipient(s), you are hereby notified that any dissemination, unauthorized review, use, disclosure or distribution of this email and any materials contained in any attachments is prohibited. If you receive this message in error, or are not the intended recipient(s), please immediately notify the sender by email and destroy all copies of the original message, including attachments.