You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trustieforge/app/models/kindeditor/asset.rb

15 lines
417 B

class Kindeditor::Asset < ActiveRecord::Base
self.table_name = 'kindeditor_assets'
mount_uploader :asset, Kindeditor::AssetUploader
validates_presence_of :asset
before_save :update_asset_attributes
attr_accessible :asset
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