Sha256: b06cb9c408aa782aebb8176b94bc17bdb31763a68ed38214705a8eeb7c1d07a8
Contents?: true
Size: 536 Bytes
Versions: 6
Compression:
Stored size: 536 Bytes
Contents
module Lolita module Upload class File < ActiveRecord::Base self.table_name = 'lolita_files' mount_uploader :asset, FileUploader belongs_to :fileable, polymorphic: true before_save :set_metadata private def set_metadata unless self.asset.blank? self.name ||= ::File.basename(self.asset.store_path) self.asset_size = self.asset.file.size self.asset_extension = ::File.extname(self.asset.store_path).gsub(".", "") end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems