diff --git a/app/models/screenshot.rb b/app/models/screenshot.rb index d87028e..21f1a01 100644 --- a/app/models/screenshot.rb +++ b/app/models/screenshot.rb @@ -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