Sha256: 4e5bbee58fed5515cc0cd840e09e0f15cb191d1f3d1c9d7ad1ac4775b3317446

Contents?: true

Size: 859 Bytes

Versions: 6

Compression:

Stored size: 859 Bytes

Contents

class WcoHosting::Appliance
  include Mongoid::Document
  include Mongoid::Timestamps
  store_in collection: 'wco_appliances'

  belongs_to :leadset, class_name: 'Wco::Leadset', inverse_of: :appliances

  field :service_name
  before_validation :set_service_name, on: :create, unless: ->{ service_name }
  def set_service_name
    self[:service_name] = host.gsub(".", "_")
  end

  field :environment

  field :subdomain
  field :domain
  def host
    "#{subdomain}.#{domain}"
  end

  belongs_to :appliance_tmpl, class_name: 'WcoHosting::ApplianceTmpl'
  def tmpl
    appliance_tmpl
  end
  def kind
    tmpl.kind
  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

6 entries across 6 versions & 1 rubygems

Version Path
ish_models-3.1.0.21 app/models/wco_hosting/appliance.rb
ish_models-3.1.0.20 app/models/wco_hosting/appliance.rb
ish_models-3.1.0.19 app/models/wco_hosting/appliance.rb
ish_models-3.1.0.18 app/models/wco_hosting/appliance.rb
ish_models-3.1.0.17 app/models/wco_hosting/appliance.rb
ish_models-3.1.0.16 app/models/wco_hosting/appliance.rb