This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/app/models/asset.rb

24 lines
514 B
Ruby

class Asset
include Mongoid::Document
include Mongoid::Timestamps
mount_uploader :data, FileAssetUploader
field :filename
field :description
has_one :i18n_variable, :as => :language_value, :autosave => true, :dependent => :destroy
validates_presence_of :filename, :data, :asset_category_id
belongs_to :asset_category
belongs_to :assetable, polymorphic: true
has_and_belongs_to_many :tags, :class_name => "AssetTag"
def sorted_tags
tags.order_by(I18n.locale, :asc)
end
end