2020-04-24 14:38:28 +00:00
|
|
|
class SiteServer
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
include OrbitCategory::Categorizable
|
|
|
|
include OrbitTag::Taggable
|
|
|
|
include OrbitModel::Status
|
|
|
|
field :server_name , type: String ,default: ''
|
|
|
|
field :domain_name , type: String ,default: ''
|
2021-01-28 03:10:41 +00:00
|
|
|
field :domain_names, type: Array, default: []
|
2020-04-24 14:38:28 +00:00
|
|
|
field :ip , type: String ,default: ''
|
|
|
|
field :account , type: String ,default: ''
|
|
|
|
field :password , type: String ,default: ''
|
|
|
|
field :active , type: Boolean ,default: true
|
2021-01-28 03:10:41 +00:00
|
|
|
def domain_names
|
|
|
|
if self.domain_name != ''
|
|
|
|
[self.domain_name]
|
|
|
|
else
|
|
|
|
super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
before_save do
|
|
|
|
if self.domain_name != '' && self.domain_names.length !=0
|
|
|
|
self.domain_name = ''
|
|
|
|
end
|
|
|
|
end
|
2020-04-24 14:38:28 +00:00
|
|
|
end
|