Last active
August 29, 2015 14:23
-
-
Save iberianpig/3785451d6802a8e3eaa1 to your computer and use it in GitHub Desktop.
3桁"/"区切りのurlを生成する。paperclipで生成されるurlをidから作る。
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
#NOTE: create id_hash for paperclip's url | |
# e.g) photo_id = 14721; format("%09d", photo_id).split("").each_slice(3).map{ |array| array.join("") }.join("/") | |
# # => "000/014/721" | |
id_hash = format("%09d", photo_id).split("").each_slice(3).map{ |array| array.join("") }.join("/") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment