diff --git a/app/models/avatar.rb b/app/models/avatar.rb index 9b97fb2cb..81af22c72 100644 --- a/app/models/avatar.rb +++ b/app/models/avatar.rb @@ -10,7 +10,7 @@ class Avatar < ActiveRecord::Base end end has_attached_file :avatar, styles: AVATAR_SIZES_HASH - validates_inclusion_of :avatar_file_size, in: (0..MAX_AVATAR_SIZE), allow_nil: true + validates_attachment_size :avatar, less_than_or_equal_to: MAX_AVATAR_SIZE validates_attachment_content_type :avatar, content_type: /\Aimage/ validates_attachment_file_name :avatar, matches: [ /(png|jpe?g|gif|bmp|tif?f)\z/i ] diff --git a/lib/modules/models/git.rb b/lib/modules/models/git.rb index cef3e9df4..026880e96 100644 --- a/lib/modules/models/git.rb +++ b/lib/modules/models/git.rb @@ -9,7 +9,7 @@ module Modules included do has_attached_file :srpm - validates_attachment :srpm, size: { in: 0..500.megabytes } + validates_attachment_size :srpm, less_than_or_equal_to: 500.megabytes validates_attachment_content_type :srpm, content_type: ['application/octet-stream', "application/x-rpm", "application/x-redhat-package-manager"], message: I18n.t('layout.invalid_content_type') after_create :create_git_repo