client_management/app/models/site_server.rb

27 lines
782 B
Ruby

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: ''
field :domain_names, type: Array, default: []
field :ip , type: String ,default: ''
field :account , type: String ,default: ''
field :password , type: String ,default: ''
field :active , type: Boolean ,default: true
field :has_certbot, type: Boolean , default: false
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
end