class Bosh::Director::Models::Deployment

Public Class Methods

create_with_teams(attributes) click to toggle source
# File lib/bosh/director/models/deployment.rb, line 28
def self.create_with_teams(attributes)
  teams = attributes.delete(:teams)
  deployment = create(attributes)
  deployment.teams = teams
  deployment
end

Public Instance Methods

teams=(teams) click to toggle source
# File lib/bosh/director/models/deployment.rb, line 35
def teams=(teams)
  Bosh::Director::Transactor.new.retryable_transaction(Deployment.db) do
    self.remove_all_teams
    (teams || []).each do |t|
      self.add_team(t)
    end
  end
end
validate() click to toggle source
# File lib/bosh/director/models/deployment.rb, line 13
def validate
  validates_presence :name
  validates_unique :name
  validates_format VALID_ID, :name
end