Sha256: ae8f2204f6f263ba2f21a9baf2021ecb33d2273246971f5b6f0c770170c59ca1
Contents?: true
Size: 551 Bytes
Versions: 1
Compression:
Stored size: 551 Bytes
Contents
require 'carrierwave/mongoid' class Kindeditor::Asset include Mongoid::Document include Mongoid::Timestamps mount_uploader :asset, Kindeditor::AssetUploader field :file_size, :type => Integer field :file_type, :type => String validates_presence_of :asset before_save :update_asset_attributes def self.collection_name :kindeditor_assets end private def update_asset_attributes if asset.present? && asset_changed? self.file_size = asset.file.size self.file_type = asset.file.content_type end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_kindeditor-0.4.0 | lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/asset.rb |