0
0
Fork 0

Detect extension for preview card (#2679)

* Detect extension for preview card

* next
This commit is contained in:
Yamagishi Kazutoshi 2017-05-01 23:20:57 +09:00 committed by Eugen Rochko
parent 5259319cf5
commit 1899cf5f04
3 changed files with 24 additions and 15 deletions

View file

@ -11,6 +11,8 @@ class PreviewCard < ApplicationRecord
has_attached_file :image, styles: { original: '120x120#' }, convert_options: { all: '-quality 80 -strip' }
include Attachmentable
validates :url, presence: true
validates_attachment_content_type :image, content_type: IMAGE_MIME_TYPES
validates_attachment_size :image, less_than: 1.megabytes