smallroomsoftware.com

file_column plugin and Capistrano (Switchtower)

Posted on May 01, 2006

Just ran into a problem using the file column plugin and Capistrano (formerly Switchtower). As others have found out, by default, file_column saves files under public/... but the public directory is replaced every time you run rake remote:deploy. I got around the problem by specifying some extra configuration in my models that use file column:

1
2
3
4
class Photo < ActiveRecord::Base
  file_column :image, :root_path =>
      File.join(RAILS_ROOT, "public/system"),
      :web_root => 'system/'

Capistrano always symlinks public/system to my-app/shared/system which isn't touched between releases. And when developing locally, file_column simple creates a directory public/system. You'll want to add 'system' to 'svn:ignores' in the 'public' directory.

Hosting by site5.com