Sha256: 71fff30c83d2145d2dc442ce8d83ba30a951036470ca9adbd57a55cc22a72b43
Contents?: true
Size: 674 Bytes
Versions: 8
Compression:
Stored size: 674 Bytes
Contents
module Panda module Core module Media extend ActiveSupport::Concern included do has_one_attached :featured_image has_many_attached :attachments validates :featured_image, content_type: [:png, :jpg, :jpeg], size: {less_than: 5.megabytes} end def image_url(variant: nil) return nil unless featured_image.attached? case variant when :thumbnail featured_image.variant(resize_to_fill: [200, 200]).processed when :medium featured_image.variant(resize_to_fill: [400, 400]).processed else featured_image end end end end end
Version data entries
8 entries across 8 versions & 2 rubygems