Sha256: 279ae1e613cc8c8d95754a25b4f2daf4b2eb230296cf5c9ec937b68322d02b6b
Contents?: true
Size: 559 Bytes
Versions: 14
Compression:
Stored size: 559 Bytes
Contents
module Kuhsaft class Asset < ActiveRecord::Base scope :by_date, -> { order('updated_at DESC') } mount_uploader :file, Kuhsaft::AssetUploader def file_type return unless file.path.present? ext = File.extname(file.path).split('.').last ext.to_sym if ext.present? end def name File.basename(file.path) if file.present? && file.path.present? end def path file.url end def path=(_val) # do nothing end def filename try(:file).try(:file).try(:filename) end end end
Version data entries
14 entries across 14 versions & 2 rubygems