kindeditor资源类
This commit is contained in:
parent
a0e8abb5ea
commit
4817b3106e
|
@ -0,0 +1,15 @@
|
|||
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
|
|
@ -0,0 +1,3 @@
|
|||
class Kindeditor::File < Kindeditor::Asset
|
||||
mount_uploader :asset, Kindeditor::FileUploader
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class Kindeditor::Flash < Kindeditor::Asset
|
||||
mount_uploader :asset, Kindeditor::FlashUploader
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class Kindeditor::Image < Kindeditor::Asset
|
||||
mount_uploader :asset, Kindeditor::ImageUploader
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class Kindeditor::Media < Kindeditor::Asset
|
||||
mount_uploader :asset, Kindeditor::MediaUploader
|
||||
end
|
Loading…
Reference in New Issue