Sha256: 12cb7c34c6ba7c65c00b41d7f73c99386f3dd5e4b3f193a7b949b9694a29f9e1
Contents?: true
Size: 523 Bytes
Versions: 2
Compression:
Stored size: 523 Bytes
Contents
module Ecm::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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ecm_blog-1.3.1 | app/models/ecm/blog/asset_detail.rb |
ecm_blog-1.3.0 | app/models/ecm/blog/asset_detail.rb |