1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 20:00:06 +08:00
SpaceVim/bundle/vim-matchup/test/issues/36/image_uploader.rb

22 lines
406 B
Ruby
Raw Normal View History

2020-06-13 14:06:35 +08:00
return unless original_filename
if model && model.read_attribute(mounted_as).present?
model.read_attribute(mounted_as)
else
"#{SecureRandom.hex(5)}.#{file.extension}"
end
end
def store_dir
"u/#{model.user_id}/#{model.id}"
end
def extension_whitelist
%w[jpg jpeg png]
end
version :thumb do
process resize_to_fit: [150, 150]
end
end