Answer the question
In order to leave comments, you need to log in
Where is the error in the code for loading avatars?
Need help.
I'm not very strong in Rails yet and there is a bug here that I can't find.
# frozen_string_literal: true
class AvatarUploader < ApplicationUploader
include Piet::CarrierWaveExtension
process :auto_orient,
:strip,
convert: 'jpg',
resize_to_cover: [1125, 1125],
optimize: [{ quality: 80, level: 0 }]
version :s828px { process resize_to_cover: [828, 828] }
version :s750px { process resize_to_cover: [750, 750] }
version :s552px { process resize_to_cover: [552, 552] }
version :s300px { process resize_to_cover: [300, 300] }
version :s216px { process resize_to_cover: [216, 216] }
version :s200px { process resize_to_cover: [200, 200] }
version :s156px { process resize_to_cover: [156, 156] }
version :s144px { process resize_to_cover: [144, 144] }
version :s132px { process resize_to_cover: [132, 132] }
version :s104px { process resize_to_cover: [104, 104] }
version :s96px { process resize_to_cover: [96, 96] }
version :s88px { process resize_to_cover: [88, 88] }
version :s72px { process resize_to_cover: [72, 72] }
version :s64px { process resize_to_cover: [64, 64] }
version :s60px { process resize_to_cover: [60, 60] }
def default_filename
['avatar', model.gender || 'male', version_name].compact.join('_') + '.png'
end
end
Answer the question
In order to leave comments, you need to log in
Inside there:
Accordingly, the correct syntax would be:
or
This is because {} has a higher priority than do/end.
There's a syntax error in the Ruby code. If it is already fixed, then you must also restart the web server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question