* Bump rubocop from 1.18.4 to 1.19.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.18.4 to 1.19.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.18.4...v1.19.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Rubocop autofixes * Manually fix some Rubocop warnings/errors * How about another coffee, Michael? * Maybe Rubocop needs a coffee too Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Michael Kohl <citizen428@forem.com>
16 lines
354 B
Ruby
16 lines
354 B
Ruby
class ProfileImageUploader < BaseUploader
|
|
def filename
|
|
"#{secure_token}.#{file.extension}" if original_filename.present?
|
|
end
|
|
|
|
def size_range
|
|
1..(2.megabytes)
|
|
end
|
|
|
|
protected
|
|
|
|
def secure_token
|
|
var = :"@#{mounted_as}_secure_token"
|
|
model.instance_variable_get(var) || model.instance_variable_set(var, SecureRandom.uuid)
|
|
end
|
|
end
|