views:

56

answers:

1

I'm trying to use the Attachment_Fu plugin in a Rails project, and want to customize the paths where uploaded files are saved.

The documentation shows this option:

:partition # Whether to partiton files in directories like /0000/0001/image.jpg. Default is true.

(The 0001 part is an ID from a table.) I don't want that, so I set the partition option to false, like so:

class Photo < ActiveRecord::Base
  has_attachment :content_type => :image,
                 :storage => :file_system,
                 :max_size => 500.kilobytes,
                 :resize_to => '320x200',
                 :thumbnails => {:thumb => '100x100>' },
                 :partition => false
  validates_as_attachment
end

...but the :partition => false option has no effect.

Has anybody else encountered this problem? How did you fix it?

A: 

I think you may also need to specify

:path_prefix => 'your/path' 

If you are disabling the auto partitioning.

Mike Buckbee
This doesn't solve it. The paths are like `/photos/0000/0002/image.jpg` with just `:partition => false`. If I add `:path_prefix => public/images/#{table_name}`, I get paths like `/images/photos/0000/0002/image.jpg`. I want to get rid of the "0000/0002" part.
Nathan Long