forked from saurabh/orbit4-5
25 lines
425 B
Ruby
25 lines
425 B
Ruby
class Asset
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
|
|
mount_uploader :data, AssetUploader
|
|
|
|
field :filename
|
|
field :description, localize: true
|
|
field :title, localize: true
|
|
|
|
delegate :url, :current_path, :size, :content_type, :filename, :to => :data
|
|
|
|
belongs_to :user
|
|
|
|
validates_presence_of :data
|
|
|
|
def content_type
|
|
data.file.content_type
|
|
end
|
|
|
|
def file_size
|
|
data.file.size
|
|
end
|
|
end
|