5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 18:26:21 +00:00
panel/app/models/metadata_image.rb

19 lines
327 B
Ruby
Raw Normal View History

2019-08-06 17:54:17 +00:00
# frozen_string_literal: true
# Define un campo de imagen
2019-11-07 16:08:14 +00:00
class MetadataImage < MetadataFile
2019-08-22 19:13:21 +00:00
def validate
super
2019-08-23 18:24:41 +00:00
errors << I18n.t('metadata.image.not_an_image') unless image?
2019-08-22 19:13:21 +00:00
errors.compact!
errors.empty?
end
2020-08-05 15:29:11 +00:00
# Determina si es una imagen
2019-08-23 18:24:41 +00:00
def image?
static_file&.blob&.send(:web_image?)
2019-08-23 18:24:41 +00:00
end
2019-08-06 17:54:17 +00:00
end