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.

Comments
  1. BrunoAugust 11, 2006 @ 10:59 AM
    Hi, I've been using file_column alongside rmagick to create thumb and medium versions of the images uploaded int my site. The other day I ran into a problem when I tried to upload an animated gif, in both the thumb and medium versions of the gif only the first frames are saved. This is the code on the model that I use to create the versions: file_column :image, :magick => { :versions => {"tiny" => "75x75", "medium" => "550x400"}} Do you happen to know how I could get around this?
  2. tom rileyAugust 11, 2006 @ 11:37 AM
    Looks like someone has got it to work by patching the file_column plugin: http://lists.rubyonrails.org/pipermail/rails/2006-April/031883.html
Post a comment
Comment



If you can read this, you don't use a typical webbrowser that plays nice with CSS.
Please do not fill in anything here!



Hosting by site5.com