Something like this in the url:
:url => "/attachments/:path/:basename_:style.:extension",
then in the interpolations:
Paperclip.interpolates :path do |attachment, style|
if attachment.instance.file_owner_type == User.class.name
# first set the _user variable (something like self.owner.id.to_s)
return "user_" + _user
else
# first set the _user, _dressing, _garmet, _category variables from your models
return "user_#{_user}/dressing_#{_dressing}/garment_#{_garmet}/category_#{_category}/"
end
end
Notice that you need to set the _user, _dressing, _garmet, _category variables from your models.
Hope this helps.
cristian
2010-10-28 09:39:39