attachment_fu problem fixed
Written by Robin Fisher in 121 words
9
Feb
Just as I shut the laptop last night to go to bed, I came up with a solution to my leading slash problem.
attachment_fu’s default behaviour is to partition the directories into which it stores files based on id. In my case, my images were being placed into the folder public/images/0000/#{id}.
As such, I amended my deploy.rb file to read:
task :after_update_code, :roles => :app do
%w{0000}.each do |share|
run "rm -rf #{release_path}/public/images/#{share}"
run "mkdir -p #{shared_path}/system/images/#{share}"
run "ln -s #{shared_path}/system/images/#{share} #{release_path}/public/images/#{share}"
end
end
This symlinked the 0000 directory to an identically named directory in the shared part of the system.
I’ve deployed a couple of times since then and my images are still accessible.