Created
September 26, 2008 15:35
-
-
Save maxim/13129 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Paperclip::Attachment.interpolations[:hashed_id_3x3] = lambda do |attachment, style| | |
hash = Digest::MD5.hexdigest(attachment.instance.id.to_s) | |
hash_path = '' | |
3.times { hash_path += '/' + hash.slice!(0..2) } | |
hash_path(1..12) | |
end | |
Paperclip::Attachment.interpolations[:hashed_id] = lambda do |attachment, style| | |
Digest::MD5.hexdigest(attachment.instance.id.to_s) | |
end | |
Paperclip::Attachment.interpolations[:kind] = lambda do |attachment, style| | |
attachment.instance.kind | |
end | |
Paperclip::Attachment.interpolations[:format] = lambda do |attachment, style| | |
attachment.instance.format | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment