25 lines
423 B
Ruby
25 lines
423 B
Ruby
# encoding: utf-8
|
|
class BulletinFile
|
|
|
|
include Mongoid::Document
|
|
include Mongoid::Timestamps
|
|
|
|
mount_uploader :file, AssetUploader
|
|
|
|
field :description, localize: true
|
|
field :title, localize: true
|
|
field :choose_lang, :type => Array, :default => ["en","zh_tw"]
|
|
|
|
belongs_to :bulletin
|
|
|
|
|
|
def enabled_for?(lang)
|
|
if lang.nil?
|
|
return true
|
|
else
|
|
return self.choose_lang.include?(lang)
|
|
end
|
|
end
|
|
|
|
end
|