开发者

Attachment_fu: can't disable :partition option

开发者 https://www.devze.com 2022-12-21 23:43 出处:网络
I\'m trying to use the Attachment_Fu plugin in a Rails project, and want to customize the paths where uploaded files are saved.

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 encoun开发者_如何转开发tered this problem? How did you fix it?


I think you may also need to specify

:path_prefix => 'your/path' 

If you are disabling the auto partitioning.

0

精彩评论

暂无评论...
验证码 换一张
取 消