Sha256: faf009ca4e91472fa2176fc3e0c408cf0a1b4f6a45c2139c42d78fd390cd04c2
Contents?: true
Size: 651 Bytes
Versions: 2
Compression:
Stored size: 651 Bytes
Contents
module Cmor::Files class FileDetail < ApplicationRecord belongs_to :folder belongs_to :asset, class_name: 'ActiveStorage::Attachment', dependent: :destroy # acts as published include ActsAsPublished::ActiveRecord acts_as_published # acts as list acts_as_list scope: :folder default_scope { order(folder_id: :desc, position: :asc) } # slugs extend FriendlyId friendly_id :title, use: :slugged validates :identifier, uniqueness: { scope: [ :folder_id ] }, allow_blank: true, allow_nil: true def label title.presence || asset&.blob&.filename&.to_s&.truncate(64).presence end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cmor_files-0.0.60.pre | app/models/cmor/files/file_detail.rb |
cmor_files-0.0.59.pre | app/models/cmor/files/file_detail.rb |