captured sparks

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:

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.

You can talk to me, or trackback from your own site. Or, if you're looking for more things to read? Why not check out the Archive.

Talk to me