igorkasyanchuk/active_storage_validations

Make sure a zero byte image is properly managed

Mth0158 opened this issue · 0 comments

Add test for case like:

class Screenshot < ApplicationRecord
  has_one_attached :image
  validates :image, attached: true, content_type: [:png], processable_image: true

  def medium_image
    if self.image.attached?
      self.image.variant(
        resize_to_limit: [670, 600]
      ).processed
    end
  end
end

From #91