Prevent empty report reasons for screenshots
This commit is contained in:
parent
ff0b93380a
commit
36ef94d763
1 changed files with 1 additions and 4 deletions
|
|
@ -1,10 +1,6 @@
|
|||
class Screenshot < ActiveRecord::Base
|
||||
belongs_to :package, :inverse_of=>:screenshots
|
||||
|
||||
# default_scope {
|
||||
# order('created_at DESC')
|
||||
# }
|
||||
|
||||
has_attached_file :image,
|
||||
styles: { :large => '800x600>', :thumb => '160x120>' },
|
||||
default_url: '/images/dummy/no-screenshots-available.svg',
|
||||
|
|
@ -13,6 +9,7 @@ class Screenshot < ActiveRecord::Base
|
|||
validates_attachment_content_type :image, :content_type => 'image/png'
|
||||
validates_with AttachmentSizeValidator, :attributes => :image, :less_than => 5.megabytes
|
||||
validate :validate_image_is_unique
|
||||
validates :delete_reason, length: { in: 5..100 }, allow_nil: true
|
||||
|
||||
# Validator that checks if the image has already been uploaded.
|
||||
# A generic uniqueness validator does not work because it would attribute
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue