registered-sites/app/models/site_annc.rb

17 lines
555 B
Ruby
Raw Normal View History

2020-04-01 03:44:59 +00:00
class SiteAnnc
include Mongoid::Document
include Mongoid::Timestamps
field :title,type: Hash, default: {en:'',zh_tw:''}
field :visible, type: Boolean, default: true
field :content,type: Hash, default: {en:'',zh_tw:''}
field :see_more_link
field :recieve_sites,type: Array, default: []
field :watch_list,type: Array, default: []
field :send_all,type: Boolean,default: false
def recieve_sites
RegisteredSite.find(self[:recieve_sites]) rescue []
end
def recieve_sites=(value)
self[:recieve_sites] = Array(value).uniq
end
end