2014-05-14 11:52:06 +00:00
|
|
|
class ArchiveFileMultiple
|
|
|
|
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
|
|
|
|
mount_uploader :file, AssetUploader
|
|
|
|
|
|
|
|
field :file_title, localize: true
|
|
|
|
# field :description
|
2015-03-18 09:59:03 +00:00
|
|
|
field :download_count, type: Integer, default: 0
|
2014-05-14 11:52:06 +00:00
|
|
|
field :choose_lang, :type => Array, :default => nil
|
|
|
|
|
|
|
|
field :should_destroy, :type => Boolean
|
|
|
|
field :sort_number, :type => Integer
|
|
|
|
|
|
|
|
# default_scope asc(:sort_number)
|
|
|
|
|
|
|
|
def choose_lang_display(lang)
|
|
|
|
self.choose_lang.include?(lang)
|
|
|
|
end
|
|
|
|
|
|
|
|
belongs_to :archive_file
|
|
|
|
|
|
|
|
# has_many :archive_file_multiple_langs, :autosave => true, :dependent => :destroy
|
|
|
|
|
|
|
|
# accepts_nested_attributes_for :archive_file_multiple_langs, :allow_destroy => true
|
|
|
|
|
|
|
|
end
|