Sha256: fbae88c703b4f57682117ccb2fd172a185f69e8a4942c50f5775b90ba47bd7dd
Contents?: true
Size: 524 Bytes
Versions: 33
Compression:
Stored size: 524 Bytes
Contents
module Cmor::Blog class AssetDetail < ApplicationRecord belongs_to :post belongs_to :asset, class_name: 'ActiveStorage::Attachment', dependent: :destroy acts_as_list scope: :post_id scope :images, -> { joins(asset: [:blob]).where("active_storage_blobs.content_type LIKE '%image/%'") } scope :non_images, -> { joins(asset: [:blob]).where("active_storage_blobs.content_type NOT LIKE '%image/%'") } def filename asset.blob.filename end def human filename end end end
Version data entries
33 entries across 33 versions & 1 rubygems