Attachment_fu default path

Hi all. I’ve done a little google search, but doesn’t find anything
(with “attachment_fu default path”) that could help me in changing
attachment_fu’s default path.

My model:

[audio.rb]
has_attachment :max_size => 20.megabytes
has_attachment :content_type => “audio/mpeg”
has_attachment :storage => :file_system
has_attachment :path_prefix => "public/files
[/audio.rb]

But all my files go on been uploaded to public/files/0000/00[last
inserted
id]/my_file_name.ext.

What am I missing? I want that all my files go to public/files.

Thank you very much amd sorry my poor english.

Davi V.

E-mail: [email protected]
MSN : [email protected]
GTalk : [email protected]
Skype : davi vidal
ICQ : 138815296

Em Ter 25 Set 2007, Davi escreveu:

has_attachment :path_prefix => "public/files
[/audio.rb]

But all my files go on been uploaded to public/files/0000/00[last inserted
id]/my_file_name.ext.

What am I missing? I want that all my files go to public/files.

Thank you very much amd sorry my poor english.

Any tip?

TIA,

Davi V.

E-mail: [email protected]
MSN : [email protected]
GTalk : [email protected]
Skype : davi vidal
ICQ : 138815296

Davi,
You need to over write
Technoweenie::Attachment_fu::Backends::FileSystemBackend#partitioned_path
to change this. To do this, just write a function in your model like
this

def partitioned_path(*args)
#what ever you want it to do
end

you should probably think hard about doing this – especially about
directory size and scalablity. If you decide you want to, be sure to
check out the original and understand how it works before you write
anything. Hope this helps.

  • Paul Saieg

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs