17 lines
555 B
Ruby
17 lines
555 B
Ruby
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 |