25 lines
426 B
Ruby
25 lines
426 B
Ruby
|
# encoding: utf-8
|
||
|
class EventNewsFile
|
||
|
|
||
|
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 :event_news
|
||
|
|
||
|
|
||
|
def enabled_for?(lang)
|
||
|
if lang.nil?
|
||
|
return true
|
||
|
else
|
||
|
return self.choose_lang.include?(lang)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|