Carrierwave: Move version name to end of filename, instead of front
Simply use #full_filename
under the version
block:
class AvatarUploaer < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
version :thumb do
process resize_to_fill: [50, 50]
def full_filename(for_file = model.logo.file)
parts = for_file.split('.')
extension = parts[-1]
name = parts[0...-1].join('.')
"#{name}_#{version_name}.#{extension}"
end
end
end
The result will be following:
/Users/user/app/uploads/1x1.gif
/Users/user/app/uploads/1x1_thumb.gif
- More information in Wiki: How to: Migrate from one model to another
- MVP example: https://gist.github.com/itsNikolay/2394f84f31db33d4c3dc6634068b0259