captured sparks

Live from Stevenage, England
09 February, 2008

attachment_fu problem fixed

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:

1
2
3
4
5
6
7
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.


Comments

There are no comments yet. Why not be the first?

Leave a comment