Sha256: 848086530f7c5c0ff123e95df7c86edcc32bfd7a7724bf71fe182b6cf1f596fd
Contents?: true
Size: 539 Bytes
Versions: 5
Compression:
Stored size: 539 Bytes
Contents
require 'carrierwave/mongoid' class Kindeditor::Asset self.collection_name = 'kindeditor_assets' include Mongoid::Document include Mongoid::Timestamps mount_uploader :asset field :file_size, :type => Integer field :file_type, :type => String validates_presence_of :asset before_save :update_asset_attributes attr_accessible :asset private def update_asset_attributes if asset.present? && asset_changed? self.content_type = asset.file.content_type self.file_size = asset.file.size end end end
Version data entries
5 entries across 5 versions & 1 rubygems