Created
January 21, 2019 14:43
-
-
Save ZakharDay/9fc674498d9a3cbc81a271e0762503f1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def filename | |
"#{secure_token}.#{file.extension}" if original_filename.present? | |
end | |
private | |
def secure_token | |
var = :"@#{mounted_as}_secure_token" | |
model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.uuid) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment