event_news/app/models/event_news_file.rb

25 lines
426 B
Ruby
Raw Normal View History

2020-07-22 02:23:36 +00:00
# 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