Sha256: 2ad3b4395a5037fc57a71ae465e11d3f0039134a2b6b6712a17a721e9a60057d
Contents?: true
Size: 945 Bytes
Versions: 1
Compression:
Stored size: 945 Bytes
Contents
class WcoHosting::Appliance include Mongoid::Document include Mongoid::Timestamps store_in collection: 'wco_appliances' field :name validates :name, uniqueness: { scope: :leadset }, presence: true before_validation :set_name, on: :create, unless: ->{ name } def set_name name = "#{Time.now.strftime('%Y%m%d')}-#{(0...8).map { (65 + rand(26)).chr }.join}" end belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :appliances field :kind field :service_name field :environment field :subdomain field :domain def host "#{subdomain}.#{domain}" end belongs_to :appliance_tmpl, class_name: 'WcoHosting::ApplianceTmpl' def tmpl appliance_tmpl end belongs_to :serverhost, class_name: 'WcoHosting::Serverhost' # field :ip field :port STATE_PENDING = 'state-pending' STATE_LIVE = 'state-live' STATE_TERM = 'state-term' field :state, default: STATE_PENDING end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ish_models-3.1.0.15 | lib/wco_hosting/appliance.rb |