I'm using this Paperclip configuration:
has_attached_file :image, :storage => :s3,
:styles => { :medium => "600x600>", :small => "320x320>", :thumb => "100x100#" },
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:path => "/:style/:filename"
This gives me nice-looking paths, but it breaks when two files have both the same style and filename (i.e., one file clobbers the other)
I want it all – nice-looking paths when filenames are unique, and no clobbering when they're not. I.e., I want to determine the path like this:
def path
if filename_is_unique
"/:style/:filename"
else
"/:style/:id_:filename"
end
end
How can I accomplish this within Paperclip?