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